Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot mount more than one subapp on the same path #159

Open
talentlessguy opened this issue Feb 23, 2021 · 0 comments
Open

Cannot mount more than one subapp on the same path #159

talentlessguy opened this issue Feb 23, 2021 · 0 comments

Comments

@talentlessguy
Copy link

talentlessguy commented Feb 23, 2021

Description

When trying to request a route from the second subapp mounted on the same path, it returns 404.

This happens because the first subapp responds with 404 (e.g. calls no match handler) and therefore doesn't switch to the next app, resulting in 404 even though the route is present in another app.

Code

import App from 'polka'

const router = App()
router.get('/upload', (req, res) => res.end('upload'))

const router2 = App()
router2.get('/product', (req, res) => res.end('product'))


const app = App()

app.use('/api/v1', router, router2)

app.listen(3000, () => console.log(`Started on :3000`))

Expected result

$ curl localhost:3000/api/v1/product
product

Same code but with Express v4 returns the expected result.

Actual result

$ curl localhost:3000/api/v1/product
Not Found

Info

  • polka: 1.0.0-next.11
  • Node.js: 15.8
  • uname -r: 5.10.15-1-MANJARO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant