git.iko.soy/typeable/servant
on master help sign in
tutorial: formatting for bash sections
ac02a28Sönke Hahn
doc/tutorial/Server.lhs+32−32
@@ -595,11 +595,11 @@ app2 = serve personAPI server4
595And we're good to go:
595And we're good to go:
596
596
597``` bash
597``` bash
598− $ curl http://localhost:8081/persons
598+$ curl http://localhost:8081/persons
599− [{"lastName":"Newton","firstName":"Isaac"},{"lastName":"Einstein","firstName":"Albert"}]
599+[{"lastName":"Newton","firstName":"Isaac"},{"lastName":"Einstein","firstName":"Albert"}]
600− $ curl -H 'Accept: text/html' http://localhost:8081/persons
600+$ curl -H 'Accept: text/html' http://localhost:8081/persons
601− <table><tr><td>first name</td><td>last name</td></tr><tr><td>Isaac</td><td>Newton</td></tr><tr><td>Albert</td><td>Einstein</td></tr></table>
601+<table><tr><td>first name</td><td>last name</td></tr><tr><td>Isaac</td><td>Newton</td></tr><tr><td>Albert</td><td>Einstein</td></tr></table>
602− # or just point your browser to http://localhost:8081/persons
602+# or just point your browser to http://localhost:8081/persons
603```
603```
604
604
605## The `ExceptT ServantErr IO` monad
605## The `ExceptT ServantErr IO` monad
@@ -713,33 +713,33 @@ server6 = do
713Here's how that server looks in action:
713Here's how that server looks in action:
714
714
715``` bash
715``` bash
716− $ curl --verbose http://localhost:8081/myfile.txt
716+$ curl --verbose http://localhost:8081/myfile.txt
717− [snip]
717+[snip]
718− * Connected to localhost (127.0.0.1) port 8081 (#0)
718+* Connected to localhost (127.0.0.1) port 8081 (#0)
719− > GET /myfile.txt HTTP/1.1
719+> GET /myfile.txt HTTP/1.1
720− > User-Agent: curl/7.30.0
720+> User-Agent: curl/7.30.0
721− > Host: localhost:8081
721+> Host: localhost:8081
722− > Accept: */*
722+> Accept: */*
723− >
723+>
724− < HTTP/1.1 404 Not Found
724+< HTTP/1.1 404 Not Found
725− [snip]
725+[snip]
726− myfile.txt just isnt there, please leave this server alone.
726+myfile.txt just isnt there, please leave this server alone.
727−
727+
728− $ echo Hello > myfile.txt
728+$ echo Hello > myfile.txt
729−
729+
730− $ curl --verbose http://localhost:8081/myfile.txt
730+$ curl --verbose http://localhost:8081/myfile.txt
731− [snip]
731+[snip]
732− * Connected to localhost (127.0.0.1) port 8081 (#0)
732+* Connected to localhost (127.0.0.1) port 8081 (#0)
733− > GET /myfile.txt HTTP/1.1
733+> GET /myfile.txt HTTP/1.1
734− > User-Agent: curl/7.30.0
734+> User-Agent: curl/7.30.0
735− > Host: localhost:8081
735+> Host: localhost:8081
736− > Accept: */*
736+> Accept: */*
737− >
737+>
738− < HTTP/1.1 200 OK
738+< HTTP/1.1 200 OK
739− [snip]
739+[snip]
740− < Content-Type: application/json
740+< Content-Type: application/json
741− [snip]
741+[snip]
742− {"content":"Hello\n"}
742+{"content":"Hello\n"}
743```
743```
744
744
745## Response headers
745## Response headers