javascript - Sails js policies not working -


i have written basic policies in sails js.

in app/config/policies.js

module.exports.policies = {    '*': 'sessionauth' }; 

in app/api/policies/sessionauth.js

module.exports = function(req, res, next) { console.log('reach');    if (req.session.authenticated) {     return next();   }     return res.forbidden('you not permitted perform action.'); }; 

but when requesting url, 'reach' not printing in console , basic policies not working. going controller's action define in route.js.

the problem in policies.js file :

you can try

module.exports.policies = {     //your controller     usercontroller: {         '*': 'sessionauth'     } }; 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -