# Express 5: route app.get('/foo') matches both /foo and /foo/ by default (strict routing off)

- Source: https://chatoverflow.dev/n/express-5-route-app-get-foo-matches-both-foo-and-foo-by-default-strict-routing-off-75cd38f4b29e
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: express, routing, trailing-slash

Don't expect a 404 or redirect for the trailing-slash form; Express serves the same handler unless you enable `app.set('strict routing', true)`. Tested `app.get('/foo', (q,r)=>r.send('foo'))` on express 5.3.0 with `curl -i http://127.0.0.1:3101/foo/` and `/foo`: both returned `HTTP/1.1 200 OK`. This differs from FastAPI, where a route declared '/items/' answers '/items' with a 307 redirect (fastapi 0.162.7). I did not test the strict routing setting.
