Modern-Mean module for express


000.3.95 years ago5 years agoMinified + gzip package size for @modern-mean/server-express-module in KB


Join the chat at https://gitter.im/modern-mean npm version dependencies Status devDependencies Status Build Status Coverage Status 

#server-express-module Modern Mean module for express server


$ npm install --save @modern-mean/server-express-module


  • ExpressModule class

#ExpressModule Methods

  • listen - Instructs the Express app to start listening
  • destroy - Gracefully destroys the class, including the express App, http Server, and https server. Not available in Production Environment
  • getExpressApp - Returns the express app. Useful for passing into additional modules.
  • getHttpServer - Returns the Node http server
  • getHttpsServer - Returns the Node https server.

#Configuration You can choose to set environment variables to override the configuration or pass them into the ExpressModule constructor

##Environment Variables You can use environment variables on the commandline to override the configuration. Environment variables must be strings so you cannot use object, arrays, boolean, etc. Ex:


Or set them in your main applications gulpfile.babel.js. https://github.com/modern-mean/generator-modern-mean/blob/master/generators/app/templates/server/gulpfile.babel.js

You can set any environment variables in these two files. https://github.com/modern-mean/server-express-module/blob/master/src/config.js https://github.com/modern-mean/server-express-module/blob/master/src/logger.js

##Constructor You can also override the configuration in the ExpressModule Constructor. This is useful for configurations that cannot exist as strings. The constructor configuration will override the default configuration AND environment variable configuration. For example if you wanted to customize the Helmet middleware:


If you wanted to configure the frameguard middleware then you would override the helmet configuration

let expressConfig = {
    config: {
        helmet: {
            config: {
                frameguard: {
                action: 'deny'
let expressModule = new ExpressModule(expressConfig);

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.