Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

express-boot

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-boot

A simple Express middleware to start and stop the server.

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

express-boot

A simple Express middleware to start and stop the server.

Build Status

##Install

sudo npm install --save express-boot

##Usage

var app = require('express')();
var boot = require('express-boot')(app, process.env.PORT || 3000);

/*...*/

//At the end, start the server
if(require.main === module){
    boot().start();
} else {
//In case you want to use app in your tests.
  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, process.env.PORT || 3000);
var io = require('socket.io')(boot().server);

##API

boot(app, port)

  • Accepts the Express app and 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: 3000,
  debug: true
}

Keywords

FAQs

Package last updated on 21 Nov 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc