diff --git a/app.js b/app.js index 69a14b69..b05e3b8b 100644 --- a/app.js +++ b/app.js @@ -1,11 +1,11 @@ -var express = require('express'); -var path = require('path'); -var favicon = require('serve-favicon'); -var logger = require('morgan'); -var cookieParser = require('cookie-parser'); -var bodyParser = require('body-parser'); +const express = require('express'); +const path = require('path'); +const favicon = require('serve-favicon'); +const logger = require('morgan'); +const cookieParser = require('cookie-parser'); +const bodyParser = require('body-parser'); -var mongodb = require('./db'); +var mongodb = require('./db'); var routes = require('./routes/routes'); @@ -18,14 +18,16 @@ app.set('view engine', 'pug'); app.use(favicon(path.join(__dirname, 'public', 'img', 'favicon.ico'))); app.use(logger('dev')); app.use(bodyParser.json()); -app.use(bodyParser.urlencoded({ extended: false })); +app.use(bodyParser.urlencoded({ + extended: false +})); app.use(cookieParser()); app.use(express.static(path.join(__dirname, 'public'))); app.use('/', routes); // catch 404 and forward to error handler -app.use(function(req, res, next) { +app.use(function (req, res, next) { var err = new Error('Not Found'); err.status = 404; next(err); @@ -36,7 +38,7 @@ app.use(function(req, res, next) { // development error handler // will print stacktrace if (app.get('env') === 'development') { - app.use(function(err, req, res, next) { + app.use(function (err, req, res, next) { res.status(err.status || 500); res.render('error', { message: err.message, @@ -48,7 +50,7 @@ if (app.get('env') === 'development') { // production error handler // no stacktraces leaked to user -app.use(function(err, req, res, next) { +app.use(function (err, req, res, next) { res.status(err.status || 500); res.render('error', { message: err.message, @@ -58,4 +60,4 @@ app.use(function(err, req, res, next) { mongodb.connectDB(); -module.exports = app; +module.exports = app; \ No newline at end of file