hey guys, how can i make a GET endpoint for someth...
# server
h
hey guys, how can i make a GET endpoint for something like
/book/1
or
/book/2
, or
/book/N
for any N number? I am using Javalin
edit: figured it out:
Copy code
get("/books/:id") { ctx ->
  ctx.param("id")!!.toInt()
}
d
Couple of things here.. you want to match only on numbers - currently the implementation will (probably) blow up with a 500 (server error) if you send a non-numeric, whereas you want a 4xx error (client error).
h
yeah, I noticed after i made a typo! Thanks for the heads-up