|
|
|
|
|
by rstarast
1302 days ago
|
|
The way this does routing leads to quite hard to read code, compare https://www.okapi.wiki/docs/todo-app: todoAPI conn = getTodo conn <|> getAllTodos conn
with getTodo conn = do
methodGET
pathParam @Text `is` "todos"
todoID <- pathParam @Int
...
so you need to keep in mind both the order of the alternatives in todoAPI as well as the bodies of the individual handlers. That gets unwieldy very quickly.It also seems likely to lead to the same problems with error handling that you tend to get with combinator parsers, where you usually only get details about the last failing branch, while the interesting failure might have been an earlier one. Quiz question (I don't know the answer): What happens to a request for /todos/foo? |
|