how to redirect in node.js

Viewed 44996

I'm having some issues with redirecting between directories, the problem is I can manage to redirect to another file in different directory. My directory structure looks like this:

-views
  -add_user.jade

-routes
  -index.js

I try to redirect to add_ user.jade from index.js, how would you guys do it

res.redirect('???');

If index.js in the same directory as views, the code below works

-index.js
-views
  -add_user.jade

res.redirect('./add_users');
4 Answers

In Node js res.setHeader('Location', 'url');

Related