-
Notifications
You must be signed in to change notification settings - Fork 57
Expand file tree
/
Copy path43-http.hell
More file actions
18 lines (18 loc) · 829 Bytes
/
Copy path43-http.hell
File metadata and controls
18 lines (18 loc) · 829 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
main = do
Http.run 8080 \request respond ->
if Eq.eq (Http.pathInfo request) []
then
case List.lookup (CI.mk $ Text.encodeUtf8 "Content-Type") (Http.requestHeaders request) of
Maybe.Just _x ->
respond $ Http.responseBuilder (Http.mkStatus 200 "OK") [] $
Builder.byteString $ Text.encodeUtf8 "Hello, World!"
Maybe.Nothing ->
respond $ Http.responseBuilder (Http.mkStatus 500 "Error") [] $
(Builder.byteString $ Text.encodeUtf8 "Wobble") <>
(Builder.byteString $ Text.encodeUtf8 "Wobble")
else
respond $
Http.responseFile (Http.mkStatus 400 "Not Found")
[(CI.mk (Text.encodeUtf8 "Content-Type"), Text.encodeUtf8 "text/markdown")]
"docs/readme.md"
Maybe.Nothing