Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
app.use(responseTime());
app.disable('x-powered-by');
// TODO: configure for specific routes
app.use(helmet());
// TODO: configure for specific routes
app.use(
contentValidator.validateMax({
max: MAX_CONTENT_LENGTH_ACCEPTED,
status: 400,
message: 'Exceeds Max Content.'
})
);
app.use(expressGracefulExit.middleware(app));
// TODO: configure for specific routes
app.use(bodyParser.json());
app.use(
bodyParser.urlencoded({
extended: false
})
);
// USED WITH BODY PARSER
// TODO: configure for specific routes
app.use(hpp());
if (env === 'development' || env === 'test') {
app.use(express.static(path.join(__dirname, '../../static')));
function closeServer(server, app) {
gracefulExit.init(server);
app.use(gracefulExit.middleware(app));
gracefulExit.gracefulExitHandler(app, server, {
exitProcess: false
});
}