2.2.0 • Published 10 years ago
express-bubble v2.2.0
Bubble
An express framework wrapper
Installation
npm install express-bubble --saveAttributtes
- logger:
Function- (optional) A function used to log in console. - config:
Object- An object with app configuration. - app:
express- AnExpressinstance. - databases:
Object- App databases. - childs:
Object- AppBubblechilds. - interfaces:
Object- App interfaces. - agents:
Object- App agents. - transporters:
Object- App transporters. - controllers:
Object- App controllers.
Constructor
- new
Bubble(config:Object, parentBubble (optional):Bubble) - Creates a new instance ofBubblegetting config with app configuration and an optional parameter parentBubble with an instance of the parent bubble if is the child bubble.
Config parameter attributes
| Config attribute | Type | Description |
|---|---|---|
config.domain | String | Sets app domain |
config.http.port | Number | Sets app http port |
config.https.port | Number | Sets app https port |
Methods
- enableLogging( logger (optional):
Function) - Enable logging usingloggerif passed. - run( fn:
Function) - Execute and inject dependencies tofn. - install( name:
String, bubble:Bubble) - Append bubble app. - up() - Start serving (only available if current app is root).
Available dependencies
$app-expressinstance.$config- App configuration.$databases- App databases.$libs- External modules.$logger- Logger function.$express-expressframework.$interfaces- App interfaces.$agents- App agents.$transporters- App transporters.$controllers- App controllers.$q-Qpromises library.$parent- parentBubbleinstance.
Example
var Bubble = require('express-bubble');
var bubble = new Bubble({
domain: 'localhost:3000',
http: { port: 3000 },
https: { port: 5000 }
});
bubble.run(function ($app) {
$app.get(req, res, next) {
res.send('Hello World!');
res.end();
}
});
bubble.up();