simple api log

This commit is contained in:
Andris Reinman 2017-12-22 17:53:22 +02:00
parent 3d8122fa4a
commit f44aa6f655

6
api.js
View file

@ -60,7 +60,6 @@ server.use((req, res, next) => {
if (req.route.path === '/users/:user/updates') {
req.headers['accept-encoding'] = '';
}
log.http(req.method, req.url);
next();
});
server.use(restify.plugins.gzipResponse());
@ -145,6 +144,11 @@ module.exports = done => {
submitRoutes(db, server, messageHandler, userHandler);
domainaliasRoutes(db, server);
server.use((req, res, next) => {
log.http(req.method, '%s - %s %s', req.url, res.statusCode, req.connection.remoteAddress);
next();
});
server.on('error', err => {
if (!started) {
started = true;