Sorry for my basic question, but I'm new to Haskell.
I'm following this example to receive some values from a request body, but my server also serves static files from a directory using the following code:
fileServing :: ServerPart Response
fileServing = serveDirectory EnableBrowsing ["index.html"] "./Path/"
mainFunc = simpleHTTP nullConf $ msum [
fileServing
]
I added the below code to my library but I'm not sure where to use the handlers
function, because I already have an msum
in the mainFunc
.
handlers :: ServerPart Response
handlers =
do decodeBody myPolicy
msum [
myGetData
]
myGetData :: ServerPart Response
myGetData =
do method POST
username <- look "username"
password <- look "password"
ok $ toResponse (username ++ ", " ++ password)