Closed nd2s closed 8 years ago
You need to use respond
instead of return
:
run 3000 $ controllerApp () $ get "/" (respond $ okHtml "success")
The basic idea of any block of Controller
code (Frank
is just a library for the Controller
monad), is that it either invokes respond
(in which case the rest of the computation is not executed and an HTTP response is generated), or it return
s, in which case the value of the block is taken from the argument to return
.
If the top-level Controller
return
s, the default response is a 404.
So what you're seeing is just the default response, because your top-level controller return
s rather than respond
s
Ah, makes sense, and works. Thanks for the explanation!
But then the example in the documentation here seems to be wrong.
Yes! That's wrong... thanks for pointing it out!
Maybe I am misunderstanding something, but with
simple-0.11.0
,warp-3.1.12
and following code:http://localhost:3000/ always returns error 404. Using
response
fromWeb.Simple
works fine, but I can't get it working withFrank
.