EN
Forum

Methodology

Toolbox

Platform

Automation with express

Developing Node.js applications with express simplifies the use of enb in the development mode:

To automate the ENB build using express, use express-compatible middleware. It is returned by the createMiddleware method of the lib/server/server-middleware module.

/**
 * @param {Object} options
 * @param {String} options.cdir Root directory of the project.
 * @param {Boolean} options.noLog Don't log the build process in the console.
 * @returns {Function}
 */
module.exports.createMiddleware = function(options) { /* ... */ };

Usage example:

app
    .use(require('enb/lib/server/middleware').createMiddleware())
    .get('/', function (req, res) {
        /* ... */    });
Rate the article
Report an error on GitHub or correct using prose.io.