express-boot
A simple Express middleware to start and stop the server.
##Install
sudo npm install --save express-boot
##Usage
var app = require('express')();
var boot = require('express-boot');
if(require.main === module){
boot(app).start();
} else {
module.exports = 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 = require('express')();
var boot = require('express-boot')(app);
var io = require('socket.io')(boot().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
boot().app
boot.version
boot.config(opt)
Options
//default
{
appName: 'Express app',
port: process.env.PORT || 3000,
debug: true
}
##Test
npm test
##Changelog
Latest:
0.0.1
0.0.2
0.0.3
- Port now defaults to
port.env.PORT || 3000
. - Updated readme