You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{Elysia}from"elysia";constapp=newElysia().get("/:first/:second?",async({ params })=>{const{ first, second }=params;console.log("first parameter",first,"second parameter",second);return"ok";}).listen(7777);console.log(`🦊 Elysia is running at http://${app.server?.hostname}:${app.server?.port}`,);
bun run index.ts
open a browser and type url, fill only first parameter http://localhost:7777/elysia it throws NOT_FOUND
What is the expected behavior?
browser: status: 200 response: "ok" cli: first parameter, elysia, second parameter, undefined
Your app can still have with one patameter endpoint .get("/:first, ...) that will dont understand behaviour of the previous
U can use query instead to set up additional keys
sorry. i didn't get your point. yes i can use query, wouldn't be just a workaround if api needs to utilise params? urls doesn't have one purpose that just carry data, some of needs more memorable, readable etc. your suggestion solves only carrying the data.
What version of Elysia is running?
1.1.20
What platform is your computer?
Darwin 23.6.0 arm64 arm
What steps can reproduce the bug?
bun version: 1.1.29
write simple Elysia application
index.ts
bun run index.ts
open a browser and type url, fill only first parameter
http://localhost:7777/elysia
it throws NOT_FOUNDWhat is the expected behavior?
browser:
status: 200 response: "ok"
cli:
first parameter, elysia, second parameter, undefined
What do you see instead?
browser:
status: 404 response "NOT_FOUND"
cli
Additional information
No response
Have you try removing the
node_modules
andbun.lockb
and try again yet?yes
The text was updated successfully, but these errors were encountered: