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
In the More endpoints section of the chapter "Serving an API", we define a type:
type UserAPI2 = "users" :> Get '[JSON] [User]
:<|> "albert" :> Get '[JSON] User
:<|> "isaac" :> Get '[JSON] User
and then serve the data:
server2 :: Server UserAPI2
server2 = return users2
:<|> return albert
:<|> return isaac
This seems to be error-prone, as I could easily flip, by accident, the two lines :<|> return albert and :<|> return isaac . This would compile fine, leading to great awkwardness at runtime.
Is there a better way of doing this, especially when there are many endpoints?
The text was updated successfully, but these errors were encountered:
In the More endpoints section of the chapter "Serving an API", we define a type:
and then serve the data:
This seems to be error-prone, as I could easily flip, by accident, the two lines
:<|> return albert
and:<|> return isaac
. This would compile fine, leading to great awkwardness at runtime.Is there a better way of doing this, especially when there are many endpoints?
The text was updated successfully, but these errors were encountered: