diff --git a/index.js b/index.js index a0e18e0..da29b90 100644 --- a/index.js +++ b/index.js @@ -6,6 +6,7 @@ const bodyParser = require('body-parser') const cors = require('cors') const https = require('https') const nunjucks = require('nunjucks') +const morgan = require('morgan') const routes = require('./routes') const pub = require('./pub') @@ -31,6 +32,7 @@ const sslOptions = { app.set('domain', DOMAIN) app.set('port', process.env.PORT || PORT) app.set('port-https', process.env.PORT_HTTPS || PORT_HTTPS) +app.use(morgan('combined')) app.use(bodyParser.json({ type: pub.consts.jsonldTypes })) // support json encoded bodies diff --git a/package-lock.json b/package-lock.json index 8311f7d..1c25f1f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2234,6 +2234,18 @@ "safe-buffer": "^5.1.2" } }, + "morgan": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/morgan/-/morgan-1.9.1.tgz", + "integrity": "sha512-HQStPIV4y3afTiCYVxirakhlCfGkI161c76kKFca7Fk1JusM//Qeo1ej2XaMniiNeaZklMVrh3vTtIzpzwbpmA==", + "requires": { + "basic-auth": "~2.0.0", + "debug": "2.6.9", + "depd": "~1.1.2", + "on-finished": "~2.3.0", + "on-headers": "~1.0.1" + } + }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", @@ -3085,6 +3097,11 @@ "ee-first": "1.1.1" } }, + "on-headers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz", + "integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==" + }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", diff --git a/package.json b/package.json index 7583006..3a3dd0b 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "express-basic-auth": "^1.1.5", "http-signature": "github:wmurphyrd/node-http-signature#9c02eeb", "mongodb": "^3.3.2", + "morgan": "^1.9.1", "nunjucks": "^3.2.0", "request": "^2.88.0", "request-promise-native": "^1.0.7"