Silver Library (Archived)
Extra - What is res, req? next? (node.js + express) 본문
Extra - What is res, req? next? (node.js + express)
Ayin Kim 2021. 2. 19. 21:38res and req are objects? next is parameter??? Are they functions?
These are middleware function. [res, req] are definitely middleware function.
next is function - work somewhat like callback + middleware function.
From documentation:
You can provide multiple callback functions that behave like middleware to handle a request. The only exception is that these callbacks might invoke next('route') to bypass the remaining route callbacks. You can use this mechanism to impose pre-conditions on a route, then pass control to subsequent routes if there’s no reason to proceed with the current route.
Here is the clear Answer I found!
expressjs.com/ko/guide/writing-middleware.html
For more exmaple, here monkelite.com/what-are-res-and-req-objects-in-node-js-express-framework/
stackoverflow.com/questions/39220957/nodejs-next-function-why
Btw, what is Express framework? Here!
www.tutorialspoint.com/nodejs/nodejs_express_framework.htm
'Personal DB > Unclassified record' 카테고리의 다른 글
Project note (0) | 2021.03.07 |
---|---|
블로그 리모델링 계획 - 1 (0) | 2021.03.07 |
Nodejs - EP 6 , MVC pattern (0) | 2021.02.19 |
Node.js EP 5 - routing (0) | 2021.02.19 |
nodejs EP 4 - middleware (0) | 2021.02.19 |