morgan http logging

This commit is contained in:
Will Murphy 2019-09-27 22:24:35 -05:00
parent c67ea9f7ab
commit 6f17ad2f40
3 changed files with 20 additions and 0 deletions

View file

@ -6,6 +6,7 @@ const bodyParser = require('body-parser')
const cors = require('cors') const cors = require('cors')
const https = require('https') const https = require('https')
const nunjucks = require('nunjucks') const nunjucks = require('nunjucks')
const morgan = require('morgan')
const routes = require('./routes') const routes = require('./routes')
const pub = require('./pub') const pub = require('./pub')
@ -31,6 +32,7 @@ const sslOptions = {
app.set('domain', DOMAIN) app.set('domain', DOMAIN)
app.set('port', process.env.PORT || PORT) app.set('port', process.env.PORT || PORT)
app.set('port-https', process.env.PORT_HTTPS || PORT_HTTPS) app.set('port-https', process.env.PORT_HTTPS || PORT_HTTPS)
app.use(morgan('combined'))
app.use(bodyParser.json({ app.use(bodyParser.json({
type: pub.consts.jsonldTypes type: pub.consts.jsonldTypes
})) // support json encoded bodies })) // support json encoded bodies

17
package-lock.json generated
View file

@ -2234,6 +2234,18 @@
"safe-buffer": "^5.1.2" "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": { "ms": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
@ -3085,6 +3097,11 @@
"ee-first": "1.1.1" "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": { "once": {
"version": "1.4.0", "version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",

View file

@ -10,6 +10,7 @@
"express-basic-auth": "^1.1.5", "express-basic-auth": "^1.1.5",
"http-signature": "github:wmurphyrd/node-http-signature#9c02eeb", "http-signature": "github:wmurphyrd/node-http-signature#9c02eeb",
"mongodb": "^3.3.2", "mongodb": "^3.3.2",
"morgan": "^1.9.1",
"nunjucks": "^3.2.0", "nunjucks": "^3.2.0",
"request": "^2.88.0", "request": "^2.88.0",
"request-promise-native": "^1.0.7" "request-promise-native": "^1.0.7"