removed the request logging from app.js
This commit is contained in:
20
src/app.js
20
src/app.js
@@ -11,26 +11,6 @@ app.use(helmet());
|
|||||||
app.use(express.json());
|
app.use(express.json());
|
||||||
app.use(express.urlencoded({ extended: true }));
|
app.use(express.urlencoded({ extended: true }));
|
||||||
|
|
||||||
app.use((req, res, next) => {
|
|
||||||
const start = Date.now();
|
|
||||||
|
|
||||||
res.on('finish', () => {
|
|
||||||
requestLogger.info(
|
|
||||||
{
|
|
||||||
ip: req.ip || req.connection.remoteAddress,
|
|
||||||
method: req.method,
|
|
||||||
url: req.originalUrl,
|
|
||||||
headers: req.headers,
|
|
||||||
body: req.body,
|
|
||||||
status: res.statusCode,
|
|
||||||
responseTime: `${Date.now() - start}ms`,
|
|
||||||
},
|
|
||||||
'Incoming request'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
next();
|
|
||||||
});
|
|
||||||
|
|
||||||
app.use('/api', routes);
|
app.use('/api', routes);
|
||||||
app.get('/health', (_, res) => res.send('server is healthy'));
|
app.get('/health', (_, res) => res.send('server is healthy'));
|
||||||
app.use((err, _req, res, _next) => {
|
app.use((err, _req, res, _next) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user