express-boot
A simple Express middleware to start and stop the server.
Install
sudo npm install --save express-boot
Usage
var app = ;var boot = ; /*...*/ //At the end, start the serverifrequiremain === module start; else //In case you want to use app in your tests. moduleexports = app;
Then run:
npm start
If you want to use app.set
to set your port then just pass app
to boot()
Socket.io
var app = ;var boot = app;var io = server;
API
boot(app, port)
- Accepts the Express app and/or port number
boot().start()
- Starts the Express server
boot().close()
- Closes the Express server
boot().server
- Returns the http server
boot().app
- Returns the Express app
boot.version
- Returns boot's version
boot.config(opt)
- Configures boot
Options
//default
{
appName: 'Express app',
port: process.env.PORT || 3000,
debug: true
}
Test
npm test
Changelog
Latest:
0.0.1
- Initial Commit
0.0.2
- Updated readme
0.0.3
- Port now defaults to
port.env.PORT || 3000
. - Updated readme