express-bootstrapper

1.0.2 • Public • Published

express-bootstrapper


GitHub build GitHub tag GitHub license

This modules lets you easily require a set of files (e.g. middlewares, libraries...) and will help you to keep your app.js clean. You only have to maintain a JSON configuration and the bootstrapper takes care that the items are loaded in the specified order. Inspired by Loopback boot

Installation

npm i express-bootstrapper

Usage

app.js

'use strict';
 
let express = require('express');
let app = express();
let bootstrap = require('express-bootstrapper');
 
bootstrap(app, () => {
  app.listen(3000, () => {});
});

bootstrap.json

{
  "middleware": [
    "session",
    "authentication",
    "whatever"
  ]
}

The configuration contains one item with an array of filenames which are loaded (required) in the specified order. In the given example it loads middleware/session.js, middleware/authentication.js and then middleware/whatever.js

Debugging: This module uses the express-bootstrapper namespace for debugging. To enable debug mode do the following DEBUG=express-bootstrapper node app.js.

Parameter

  • app: express application (required)
  • callback: object (optional)

Package Sidebar

Install

npm i express-bootstrapper

Weekly Downloads

1

Version

1.0.2

License

Apache-2.0

Last publish

Collaborators

  • raoulus