johnmalkovitch
johnmalkovitch

Reputation: 375

Disabling default sails.js routes and return a 404 error

I disabled the default routes in the policies file.

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

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

Upvotes: 3

Views: 589

Answers (1)

Meeker
Meeker

Reputation: 5979

Just create a policy that directs the user to the 404 as seen below. I have placed it inline, but it could be in a policy file as well.

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

Upvotes: 2

Related Questions