http logging

This commit is contained in:
Andrzej Stepien 2023-08-11 16:30:47 +02:00
parent bf6fc14abe
commit ae795f3a90
3 changed files with 27 additions and 0 deletions

20
package-lock.json generated
View File

@ -12,6 +12,7 @@
"body-parser": "^1.20.2",
"express": "^4.18.2",
"pino": "^8.15.0",
"pino-http": "^8.4.0",
"promised-sqlite3": "^2.1.0",
"undici": "^5.23.0"
},
@ -762,6 +763,14 @@
"node": ">=10"
}
},
"node_modules/get-caller-file": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
"engines": {
"node": "6.* || 8.* || >= 10.*"
}
},
"node_modules/get-intrinsic": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz",
@ -1651,6 +1660,17 @@
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
}
},
"node_modules/pino-http": {
"version": "8.4.0",
"resolved": "https://registry.npmjs.org/pino-http/-/pino-http-8.4.0.tgz",
"integrity": "sha512-9I1eRLxsujQJwLQTrHBU0wDlwnry2HzV2TlDwAsmZ9nT3Y2NQBLrz+DYp73L4i11vl/eudnFT8Eg0Kp62tMwEw==",
"dependencies": {
"get-caller-file": "^2.0.5",
"pino": "^8.0.0",
"pino-std-serializers": "^6.0.0",
"process-warning": "^2.0.0"
}
},
"node_modules/pino-std-serializers": {
"version": "6.2.2",
"resolved": "https://registry.npmjs.org/pino-std-serializers/-/pino-std-serializers-6.2.2.tgz",

View File

@ -17,6 +17,7 @@
"body-parser": "^1.20.2",
"express": "^4.18.2",
"pino": "^8.15.0",
"pino-http": "^8.4.0",
"promised-sqlite3": "^2.1.0",
"undici": "^5.23.0"
}

View File

@ -1,9 +1,15 @@
import express from "express";
import bodyParser from "body-parser";
import logger from "./logger.mjs";
import pinoHTTP from 'pino-http'
const app = express()
const port = 4000
app.use(bodyParser.json())
app.use(
pinoHTTP({
logger,
})
)
app.post('/api', (req,res) => {
console.log("webhook received:")
console.dir(req.body.body.note.text)