Completed logging thing

This commit is contained in:
Esther 2020-06-22 20:53:08 +01:00
parent 95179cd76d
commit 6c98884e33
No known key found for this signature in database
GPG Key ID: 162A307C5EBD40EA

11
app.js
View File

@ -9,13 +9,20 @@ var indexRouter = require('./routes/index');
var aboutRouter = require('./routes/about'); var aboutRouter = require('./routes/about');
var app = express(); var app = express();
app.set('trust proxy', 'loopback,uniquelocal'); app.set('trust proxy', 'loopback,uniquelocal');
app.disable('x-powered-by');
// view engine setup // view engine setup
app.set('views', path.join(__dirname, 'views')); app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'pug'); app.set('view engine', 'pug');
app.use(logger('common')); if (app.get('env') == 'production') {
app.use(logger('common', { skip: function(req, res) { return res.statusCode < 400 }, stream: __dirname + '/../morgan.log' }));
} else {
app.use(logger('dev'));
}
app.use(express.json()); app.use(express.json());
app.use(express.urlencoded({ extended: false })); app.use(express.urlencoded({ extended: false }));
app.use(cookieParser()); app.use(cookieParser());
@ -27,8 +34,6 @@ app.use(sassMiddleware({
})); }));
app.use(express.static(path.join(__dirname, 'public'))); app.use(express.static(path.join(__dirname, 'public')));
app.disable('x-powered-by');
app.use('/', indexRouter); app.use('/', indexRouter);
app.use('/about', aboutRouter); app.use('/about', aboutRouter);