This repository has been archived on 2018-10-12. You can view files and clone it, but cannot push or open issues or pull requests.
crispy-train/app/config/middleware.js

31 lines
810 B
JavaScript

'use strict';
// -----------------------------------------------------------------------------
// Middleware
// -----------------------------------------------------------------------------
const bodyParser = require('body-parser'),
cookieParser = require('cookie-parser'),
express = require('express'),
helmet = require('helmet'),
requestLogger = require('morgan'),
path = require('path');
let middleware = new Set([
// some security settings controlled by helmet
helmet.frameguard(),
helmet.hidePoweredBy(),
helmet.ieNoOpen(),
helmet.noSniff(),
helmet.xssFilter(),
// basic express middleware
requestLogger('combined'),
bodyParser.json(),
bodyParser.urlencoded({ extended: false }),
cookieParser(),
express.static(path.join(__dirname, '../../public')),
]);
module.exports = middleware;