middleware pattern1 Middleware Pattern 실제로 요청과 응답 사이에 위치하는 미들웨어 기능 체인으로,하나 이상의 미들웨어 함수를 통해 요청 객체부터 응답까지 추적하고 수정할 수 있습니다. const app = require("express")(); const html = require("./data"); app.use( "/", (req, res, next) => { req.headers["test-header"] = 1234; next(); }, (req, res, next) => { console.log(`Request has test header: ${!!req.headers["test-header"]}`); next(); } ); app.get("/", (req, re.. 2024. 12. 8. 이전 1 다음