Genie Discord forum

Author Avatargrendel
1/12/2024, 11:58:50 PM

On the Creating an API guide, the tutorial suggests that /api/hello?name=John should show a page that says "Hello John", but it gives me a 404 instead. It's worth noting that /api/hello/John works as advertised. The contents of my app.jl are as follows:

module App
using Genie

function greet()
    return "Howdy, $(params(:name))!"
end

route("/api/hello/:name", greet, method=GET)

end;
Author AvatarPere
1/15/2024, 10:52:35 AM

sorry that's a mistake, I'll fix it. the ? syntax does not work for params defined on the route path. It is intended for getting any parameter passed as ?param=valuefrom within the route handler with params(). See the first section in this doc page

https://learn.genieframework.com/docs/reference/server/payloads

Author Avatargrendel
1/18/2024, 12:44:05 AM

Changed the channel name: SOLVED This URL doesn't seem to work. Am I doing something wrong?