I'm called a "user" and a function called "signup" and so I called a policy The "stripSlashes" with the following code:
module Exports = function (Rick, Race, Next) {if (req.url.substr (-1) === '/' & amp; amp; Req.url.length & gt; 1) {res.redirect (req. Url.slice (0, -1), 301); } Else {next (); }};
Whenever is visited http: // localhost: {{port}} / user / signup /
, then I am trying to do this Redirect: http: // localhost: {{port}} / user / signup
This works perfectly!
Except, whenever I try http: // localhost: {{port}} / user / signup /////
So, my question is, with error pages (i.e. 404s) How do I implement my custom policies for everyone?
Thanks in advanced!
Policies.js For reference:
module.exports.policies = {'*': ['Flash', 'Flash', 'isAuthenticated', 'stripSlashes',' wwwRedirect '], Show: [' Flash ',' Entertainment ',' Strip Slash ',' www RDARDAR '], Index: [' Flash ',' Iethen ticated ',' stripSlashes', 'wwwRedirect'], 'Flash', 'isAuthenticated', 'stripSlashes', 'wwwRedirect'],},} < P> To implement the policy, match the policy with one way. It will be If you want to apply this rule to all API endpoint, then you can use an express custom middleware for this. See stack overflow answers here:
Comments
Post a Comment