Express-js wildcard routing to cover everything under and including a path

前端 未结 5 1249
暖寄归人
暖寄归人 2020-12-02 16:34

I\'m trying to have one route cover everything under /foo including /foo itself. I\'ve tried using /foo* which work for everything

5条回答
  •  长情又很酷
    2020-12-02 16:58

    For those who are learning node/express (just like me): do not use wildcard routing if possible!

    I also wanted to implement the routing for GET /users/:id/whatever using wildcard routing. This is how I got here.

    More info: https://blog.praveen.science/wildcard-routing-is-an-anti-pattern/

提交回复
热议问题