You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current code override the HandlerStorage.prototype.constrainer to get the constrainter in router.
It will be override when two store created first before any route trying to lookup.
constfindMyWay=require("find-my-way");constconstraint={name: "secret",storage: function(){letsecrets={};return{get: (secret)=>{returnsecrets[secret]||null;},set: (secret,store)=>{secrets[secret]=store;},del: (secret)=>{deletesecrets[secret];},empty: ()=>{secrets={};},};},deriveConstraint: (req,ctx)=>{returnreq.headers["x-secret"];},validate(){returntrue;},};letrouter1=findMyWay({constraints: {secret: constraint}});// it override the constraints of router1constrouter2=findMyWay({constraints: undefined});// it can registered constraintsrouter1.on("GET","/",{constraints: {secret: "alpha"}},()=>{});// it cannot find the constraints secretrouter1.find("GET","/",{constraints: {secret: "alpha"}});
The text was updated successfully, but these errors were encountered:
The current code override the
HandlerStorage.prototype.constrainer
to get theconstrainter
in router.It will be override when two store created first before any route trying to lookup.
The text was updated successfully, but these errors were encountered: