express-bubble
v2.2.0
Published
An express framework wrapper
Downloads
12
Readme
Bubble
An express framework wrapper
Installation
npm install express-bubble --save
Attributtes
- logger:
Function
- (optional) A function used to log in console. - config:
Object
- An object with app configuration. - app:
express
- AnExpress
instance. - databases:
Object
- App databases. - childs:
Object
- AppBubble
childs. - 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 ofBubble
getting 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 usinglogger
if 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
-express
instance.$config
- App configuration.$databases
- App databases.$libs
- External modules.$logger
- Logger function.$express
-express
framework.$interfaces
- App interfaces.$agents
- App agents.$transporters
- App transporters.$controllers
- App controllers.$q
-Q
promises library.$parent
- parentBubble
instance.
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();