2

Possible Duplicate:
Having a hard time trying to understand ‘next/next()’ in express.js

I have the following code in my app.js to handle request

app.get ('/' , routes.index);
require('./services/Category')(app);

I have Category file with the required functionalities and it works fine. But when I explore about Middleware concept there is a specific key word called "next" which is being passed in every method. How does "next" works ? What it carries ?

Community
  • 1
  • 1
syv
  • 3,528
  • 7
  • 35
  • 50
  • @scriptfromscratch -I understand that next is a call back method and next () will call the next middleware that been included in the configuration (app.configure). So if I want to keep any validation for all the end points (token validation) I have to keep the validation in separate middleware and perform is my understanding is correct ? – syv Sep 01 '12 at 06:21
  • Another explanation can be found here: http://stackoverflow.com/questions/5384526/javascript-node-js-next – Larry Hipp Sep 07 '12 at 19:12

0 Answers0