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 -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -