H
Hono4mo ago
anya

struggles with routing with file extensions after optional path parameters

hey! trying to figure out how to come up with the correct route definition for my use case. this is what i have now: /:one/:two/:three/:four?{.+\\.png$} my goal is to have the four parameter optional, but the URL must end with the extension regardless. so the route must match: - /one/two/three.png - /one/two/three/four.png the extension should not be included in the three / four parameters value too. any idea on how to achieve this? i was thinking of just validating and stripping off the extension in a middleware, but the request object is immutable, so i can't modify the URL
1 Reply
jamesfoley
jamesfoley3mo ago
@anya did you get an answer to the regex question 06/25/24. I am having a similar problem. I want to match. /jim or /jim.htm or /jim.html to serve the static jim.html file. Did you end up writing your own middleware
Want results from more Discord servers?
Add your server