fx-middleware

0.2.0 • Public • Published

Plugin: fx-middleware

Description

Common express middlewares. Implement the middleware service

Config

specify the argument --middleware [config file path] to config the middleware If the config file is not specified

Interface

morgan

web app server log middleware

config it with 'morgan' field

default:

morgan: {
  path: global.home + '/logs'
  format: 'short', // combined, common, dev, short, tiny, or user defined
  filePrefix: 'access_'
};

cookieParser

express cookie parser middleware

var cookieParser = require('cookie-parser');
return cookieParser()

urlEncodedParser

var bodyParser = require('body-parser');
return bodyParser().urlencoded({
  extended: true
})

jsonParser

var bodyParser = require('body-parser');
return bodyParser().json()

session

support three types of session:

  • memory
  • mongodb
  • redis

Config the session types with 'sessionStore' config key default: 'memory'

Config the session secret with 'sessionSecret'

Mongodb configuration is defined in mongodb service

Redis configuration is defined in redis service

compression

var compression = require('compression');
return compression()

Readme

Keywords

none

Package Sidebar

Install

npm i fx-middleware

Weekly Downloads

5

Version

0.2.0

License

none

Last publish

Collaborators

  • bhou