Tl,dr: use an if-statement in Express middleware to redirect based on user feature flags.
Yawn and flagged.
EDIT:
Also, it looks like there may be a syntax error in their handler. Comments are mine, added:
/* pretty sure that you need an = sign on your lambda arrow, folks */
const featureFlaggedRouting = (req, res, next) > {
/* what, I guess Node has an `If` library now? */
If (req.user.featureFlagExists) {
/* whoa tiger...Express middleware functions shouldn't be returning anything, least of all more middleware! */
return newRoutingLogic(req, res, next)
}
/* are we meaning to early-out above, or is this a bug? */
next()
}
Tl,dr: use an if-statement in Express middleware to redirect based on user feature flags.
Yawn and flagged.
EDIT:
Also, it looks like there may be a syntax error in their handler. Comments are mine, added:
Here, maybe you all will find the docs useful. :|
Maybe try:
Note that, without an idea of what
newRoutingLogicshould be, my refactor could be incorrect.