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

Priority routes not working #131

Open
joshbenaron opened this issue Sep 8, 2021 · 2 comments
Open

Priority routes not working #131

joshbenaron opened this issue Sep 8, 2021 · 2 comments

Comments

@joshbenaron
Copy link

node.js version: 16.8

@koa/router version: 10.1.1

koa version: 2.13.1

Code sample:

export const router = new Router()
  .get("/ping", ping)
  .get("/public", getPublic)
  .get("/account/balance", getUserBalance)
  .get("/peers", getPeers)
  .get("/peers/random/:count", getRandomPeers)
  .post("/tx", postTxRateLimiter, initialChecks, fileUpload, verifyUpload, sendSignedResponse)
  .head("/:txId", getTx)
  .get("/:txId", getTx)
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
  // @ts-ignore
  .post("/newTx", rateLimiter, jsonBodyParser, newTx);

Expected Behavior:

When I go to GET /ping - I should see a specific output

Actual Behavior:

GET /ping is going to GET /:txId

@JeDaYoshi
Copy link

Do you have a next() on your /ping middleware? If you don't want any other routes to be executed, you should remove it.

@peterver
Copy link
Contributor

peterver commented Jul 8, 2022

@joshbenaron would you consider this resolved? :)

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

3 participants