aboutsummaryrefslogtreecommitdiffstats
path: root/lib/app.ts
diff options
context:
space:
mode:
Diffstat (limited to 'lib/app.ts')
-rw-r--r--lib/app.ts19
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/app.ts b/lib/app.ts
index df696bc6..1beedcd4 100644
--- a/lib/app.ts
+++ b/lib/app.ts
@@ -22,8 +22,23 @@ const app = fastify({
const reqLogger = pino(pino.destination("req"));
const resLogger = pino(pino.destination("res"));
-app.addHook("onRequest", async (req) => {
- reqLogger.info({ url: req.raw.url, id: req.id });
+// app.addHook("onRequest", async (req) => {
+// reqLogger.info({ url: req.raw.url, id: req.id });
+// });
+//
+
+app.addHook("preHandler", async (req) => {
+ const url = req.raw.url;
+ const ignore = ["/login","/ws","/me","/confirm","/public"];
+ if (req.method === "GET" || ignore.some(path => url.startsWith(path))) return;
+
+ reqLogger.info({
+ method: req.method,
+ url,
+ headers: req.headers,
+ body: req.body,
+ id: req.id
+ });
});
app.addHook("onResponse", async (req, reply) => {