From 4a8f6b27dcc3fe2872604e6cad4df9fcee83e40d Mon Sep 17 00:00:00 2001 From: Tsu-ba-me Date: Sun, 6 Aug 2023 22:38:31 -0400 Subject: [PATCH] fix(striker-ui-api): log request method, path --- striker-ui-api/src/app.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/striker-ui-api/src/app.ts b/striker-ui-api/src/app.ts index 7a46c4ad..0a6c70bc 100644 --- a/striker-ui-api/src/app.ts +++ b/striker-ui-api/src/app.ts @@ -4,6 +4,7 @@ import express, { json } from 'express'; import { guardApi, passport, session } from './middlewares'; import routes from './routes'; import { rrouters } from './lib/rrouters'; +import { stdout } from './lib/shell'; export default (async () => { const app = express(); @@ -24,6 +25,12 @@ export default (async () => { app.use(passport.initialize()); app.use(passport.authenticate('session')); + app.use(({ originalUrl, method }, response, next) => { + stdout(`Received ${method} ${originalUrl}`); + + next(); + }); + rrouters(app, routes.private, { assign: (router) => [guardApi, router], route: '/api',