Search code examples
haskellurl-routingyesod

Send list of IDs in Yesod route


I want to have a route in my Yesod app that accepts a list of IDs

From this page it looks like you can use * in your route to accept a list but when I attempted it

/api/user/#UserId      UserR  GET DELETE
/api/users/display/*UserIds  DisplayR GET

I got the error

Not in scope: type constructor or class ‘UserIds’
Perhaps you meant one of these:
  ‘UserId’ (imported from Import.NoFoundation),

How would I accept a list of UserId in a route?


Solution

  • The route needs to be

    /api/users/display/*[UserId]  DisplayR GET
    

    And then the Handler needs to take the input type [UserId]