While porting a legacy API to LoopBack 4 I've noticed that LoopBack routing is case sensitive.
Is there a way to make it case insensitive so that it doesn't throw 404 errors if route casing is different (/api/userprofile or /api/userProfile)?
Case-insensitive routing is default in Express.js. I was expecting LB4 to behave the same way.
@dkrantsberg AFAIK, lb4 only uses Express.js for its middlewares, and uses its own routing engine. (see Circling back to Express with a twist).
lb4 does have the concept of Sequences (where the REST router is invoked), to which you can "normalize" the incoming route path before passing it into the router's findRoute()by extending and modifying DefaultSequence (see Invoke Operations using Routes) .
You can also completely replace the REST router for more flexibility (see Customize the REST router).
Yes, this is what I ended up doing. Thanks, @achrinza.
Most helpful comment
@dkrantsberg AFAIK, lb4 only uses Express.js for its middlewares, and uses its own routing engine. (see Circling back to Express with a twist).
lb4 does have the concept of Sequences (where the REST router is invoked), to which you can "normalize" the incoming route path before passing it into the router's
findRoute()by extending and modifyingDefaultSequence(see Invoke Operations using Routes) .You can also completely replace the REST router for more flexibility (see Customize the REST router).