Subapp overrides all paths, even the ones from original app
See original GitHub issueDescribe the bug
When a subapp is mounted on a path, all of the middlewares with the same path in the original app are ignored and return 404 because it’s being handled by a subapp.
To Reproduce
import { App } from '@tinyhttp/app'
import serveStatic from 'serve-static'
import sirv from 'sirv'
import path from 'path'
const app = new App()
const subapp = new App()
subapp.get('/',(req, res) => res.send('hello world'))
app.use('/', sirv('public'))
app.use('/', subapp)
app.listen(3000)
$ curl localhost:3000
hello world
$ curl localhost:3000/hello.txt
Not Found
Expected behavior
If subapp couldn’t find the handler with the request path, the original middleware should handle it instead.
$ curl localhost:3000
hello world
$ curl localhost:3000/hello.txt
I am a file
Versions
node
: 15.4.0@tinyhttp/app
: 1.1.0
Additional context
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (11 by maintainers)
Top Results From Across the Web
Subapp overrides all paths, even the ones from original app
Describe the bug When a subapp is mounted on a path, all of the middlewares with the same path in the original app...
Read more >Subapp overrides all paths, even the ones from original app #209
When a subapp is mounted on a path, all of the middlewares with the same path in the original app are ignored and...
Read more >Sub Applications - Behind a Proxy - FastAPI
In this case, the original path /app will actually be served at /api/v1/app . Even though your application "thinks" it is serving at...
Read more >yarn workspaces and lerna cause Invalid Hook call
Current behavior : In the container project, it works fine when I route to sub-app/foo . But when I route to sub-app I...
Read more >Applications - Django documentation
When INSTALLED_APPS contains the dotted path to an application module, by default, if Django finds exactly one AppConfig subclass in the apps.py submodule, ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@talentlessguy
I’ve put up a pull request to add @calumk! 🎉
@all-contributors add @calumk for bug