Unexpected 404 from Scotty

Viewed 495

I'm trying to use Scotty in Haskell, and following a tutorial, I could route a url like so:

get "/hello/:name" $ do
            name <- param "name"
            text ("Hello " <> name <> "!!")

However, what is the syntax to capture multiple route parameters? Neither of the following worked:

post "/newuser/:id/:name" $ do
            id <- param "id"
            name <- param "name"
            json $ User {userId = id, userName = name}

get "/users/{id}" $ do
            id <- param "id"
            json $ filter (matchesId id) allUsers
1 Answers
Related