diff options
| author | Adam Soltys <[email protected]> | 2025-06-16 20:54:28 +0000 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2025-06-16 20:54:29 +0000 |
| commit | e92f232d7194626d9182a5eaeff3d42d67fbb53f (patch) | |
| tree | daa2edd3a524f478c31e48a3d4e916b69b13737b /lib/app.ts | |
| parent | 25e256800754733776f8c124e7b61134a8344cbf (diff) | |
| download | coinos-server-e92f232d7194626d9182a5eaeff3d42d67fbb53f.tar.gz coinos-server-e92f232d7194626d9182a5eaeff3d42d67fbb53f.zip | |
username checks
Diffstat (limited to 'lib/app.ts')
| -rw-r--r-- | lib/app.ts | 19 |
1 files changed, 17 insertions, 2 deletions
@@ -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) => { |
