Friday, 9 June 2017

How can i separate route files?

I have a route file in my project and it is called from my app with these lines:

var index = require('./routes/index');

app.use('/', index);

But i need to separate the route file, and i'm trying to do this:

var index = require('./routes/index');
var user = require('./routes/user');

app.use('/', index);
app.use('/user', user);

in route user.js i put the service that i need to access from client. But its not working. I don't know what is wrong, i am a beginner in Node.js.



via LorD

No comments:

Post a Comment