I'm developing a single page application (SPA) using Sails.js as a backend. All I want is to redirect all routes to a single controller action.
However, when I do the following:
// config/routes.js
module.exports.routes = {
'GET *': 'MainController.application'
};
All requests are getting redirected to my application route, even for static files like CSS/JavaScript, etc. Is there an easy way to fallback to my application route when there is no other means to handle it?
I want:
After thorough re-reading of the docs I've found a skipAssets
route parameter.
Here's my new configuration:
// config/routes.js
module.exports.routes = {
'GET *': {
controller: 'MainController',
action: 'application',
skipAssets: true
}
};
Looks like it's working as required.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.