Disabling sails.js default routes and returning 404 error

I disabled default routes in the policies file.

module.exports.policies = {
  'RabbitController': {
  '*': false
  }
}

      

Is there a way to change the 403 forbidden error to 404 when trying to access a disabled route?

+3


source to share


1 answer


Just create a policy that directs the user to 404 as shown below. I put it on line, but it could also be in the policy file.



module.exports.policies = {
  'RabbitController': {
      '*': function(req,res){return res.notFound()}
  }
}

      

+2


source







All Articles