How to handle multiple subapps? #276
Replies: 2 comments 5 replies
-
hello, so the issue is that nested subapps don't work? |
Beta Was this translation helpful? Give feedback.
5 replies
-
I prepare even smaller and simpler reproducible example import { App } from '@tinyhttp/app'
const app = new App(), app1 = new App(), app2 = new App()
app1.get('/ping', (req, res, next) => {
res.send('ping')
})
app2.get('/pong', (req, res, next) => {
res.send('pong')
})
app.use(app1)
app.use(app2)
app.listen(3000) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey, last few days I came with a question about how to handle "separated routes" and just started to using subapps for that.
So, after that I started adding more subapps and I have one that gives me a swagger docs.
My main app looks like this:
My
swaggerMiddleware
:As you can see I have two "nested .use(...)" and when the first
.use()
is invoked, doesnt matter if I call next() at the end offunctionThatGeneratesTheSwaggerHandler
, my next SubApp is never invoked.I'm trying to understand if this is how the thing is meant to be, if I'm doing something (completely) wrong here or something else.
For this very moment I stopped using subapps, just passing the main app to some functions to set up the routes.
Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions