fix(striker-ui-api): log request method, path

main
Tsu-ba-me 1 year ago
parent 29f907f003
commit 4a8f6b27dc
  1. 7
      striker-ui-api/src/app.ts

@ -4,6 +4,7 @@ import express, { json } from 'express';
import { guardApi, passport, session } from './middlewares'; import { guardApi, passport, session } from './middlewares';
import routes from './routes'; import routes from './routes';
import { rrouters } from './lib/rrouters'; import { rrouters } from './lib/rrouters';
import { stdout } from './lib/shell';
export default (async () => { export default (async () => {
const app = express(); const app = express();
@ -24,6 +25,12 @@ export default (async () => {
app.use(passport.initialize()); app.use(passport.initialize());
app.use(passport.authenticate('session')); app.use(passport.authenticate('session'));
app.use(({ originalUrl, method }, response, next) => {
stdout(`Received ${method} ${originalUrl}`);
next();
});
rrouters(app, routes.private, { rrouters(app, routes.private, {
assign: (router) => [guardApi, router], assign: (router) => [guardApi, router],
route: '/api', route: '/api',

Loading…
Cancel
Save