Calling controller's action from another controller in expressjs
express, node.js, sails.js
Solution
Does the client calling the ProxyController knows how to process an HTTP Redirect?
I suspect you are using an AJAX call to hit the proxy, if that's the case then you'll need to evaluate the HTTP response and do the redirect. Browsers do this automatically, but not so AJAX calls.
Problem
In my expressjs / sailsjs app, I have 2 controllers: ``` - MainController only used to display the pages (for instance /signin route displays the signin page) - ProxyController that handles several action (API calls) ``` In one action of ProxyController I need to redirect to the signin page, I use the res.redirect('/signin') but nothing happens. In the routes I have: ``` '/signin' : { controller: 'main', action: 'signin' }, ``` Any idea on how can I call the MainController's signin action from ProxyController ?