router
router copied to clipboard
Priority routes not working
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
Do you have a next() on your /ping middleware? If you don't want any other routes to be executed, you should remove it.
@joshbenaron would you consider this resolved? :)
Resolved!