// Middleware
app.use((req, res, next) => {
console.log(`${req.method} ${req.url}`);
next();
});
// Middleware
app.use((req, res, next) => {
const start = Date.now();
console.log(`${req.method} ${req.url}`);
next();
const diffTime = Date.now() - start;
console.log(`${req.method} ${req.url} ${diffTime}`);
// 메인 task를 처리한 뒤, next() 뒷 부분을 호출합니다.
});
// GET /some_html 7ms
// GET /users 2ms