@webfocus/component

0.0.5 • Public • Published

Webfocus Logo

Webfocus

This module defines the WebfocusComponent class to help in the creation of NodeJS servers using express and Pug.

The main idea of this module is to enable the creation of independet components with the WebfocusComponent class and the creation of applications with WebfocusApp class (see @webfocus/app) using said components.

Specifically, the WebfocusComponent represents a specific component. To create a new component const webfocusComponentInstance = require('@webfocus/app/component')(name: String, description: String). Or access the class with const WebfocusComponent = require('@webfocus/app/component').WebfocusComponent with the constructor new WebfocusComponent(name: String, description: String, dirname: String);. More information of WebfocusComponent.

Getting Started

On your current project:

npm install @webfocus/component

Or use the initializer:

npm init @webfocus/component

The later will create a template WebfocusComponent (the package.json, index.js and index.pug files)

Usage

let component = module.exports = require('@webfocus/component')("Component Name", "Component Description");

component.app.get('/', (req, res) => {
    res.json("Hello World from this component!");
})

In the repository we do end-to-end tests with cypress tests on an sample implementation.

TODO

  • Create an WebfocusComponent addon to enable distribution of a heavy process

Package Sidebar

Install

npm i @webfocus/component

Weekly Downloads

0

Version

0.0.5

License

MIT

Unpacked Size

13.5 kB

Total Files

6

Last publish

Collaborators

  • diogoalmiro