기록 Node.js - 미들웨어개발, 2017.04.02
미들웨어 노드js 모듈 중 하나인 익스프레스는 미들웨어를 사용한다. 독립적인 기능을 가진 함수이다. next() 함수로 다음 미들웨어 호출 가능.미들웨어는 클라 요청은 전달 받을 수 있음.순서대로 전달.end()로 전달을 끝내고 결과를 보여줌. req: 요청res: 응답 예) 12345678910111213const express = require('express');const app = express(); app.use(function(req,res,next){ console.log("첫번째 미들웨어"); req.test = "Hello, World"; next();});app.use('/',function(req,res,next){ console.log("두번째 미들웨어"); res.end("" + ..