git.iko.soy/typeable/servant
on master help sign in
tutorial: formatting for bash sections
commitac02a2852740cb53fc801520144ca8c0b709da45 authorSönke Hahn <soenkehahn@gmail.com> dateSun 28 Feb 2016, 22:21 (11 years ago) parent2716d50
1 file changed+32−32
doc/tutorial/Server.lhs+32−32
doc/tutorial/Server.lhs+32−32
@@ -595,11 +595,11 @@ app2 = serve personAPI server4
595595And we're good to go:
596596
597597``` bash
598− $ curl http://localhost:8081/persons
599− [{"lastName":"Newton","firstName":"Isaac"},{"lastName":"Einstein","firstName":"Albert"}]
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>
602− # or just point your browser to http://localhost:8081/persons
598+$ curl http://localhost:8081/persons
599+[{"lastName":"Newton","firstName":"Isaac"},{"lastName":"Einstein","firstName":"Albert"}]
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>
602+# or just point your browser to http://localhost:8081/persons
603603```
604604
605605## The `ExceptT ServantErr IO` monad
@@ -713,33 +713,33 @@ server6 = do
713713Here's how that server looks in action:
714714
715715``` bash
716− $ curl --verbose http://localhost:8081/myfile.txt
717− [snip]
718− * Connected to localhost (127.0.0.1) port 8081 (#0)
719− > GET /myfile.txt HTTP/1.1
720− > User-Agent: curl/7.30.0
721− > Host: localhost:8081
722− > Accept: */*
723− >
724− < HTTP/1.1 404 Not Found
725− [snip]
726− myfile.txt just isnt there, please leave this server alone.
727−
728− $ echo Hello > myfile.txt
729−
730− $ curl --verbose http://localhost:8081/myfile.txt
731− [snip]
732− * Connected to localhost (127.0.0.1) port 8081 (#0)
733− > GET /myfile.txt HTTP/1.1
734− > User-Agent: curl/7.30.0
735− > Host: localhost:8081
736− > Accept: */*
737− >
738− < HTTP/1.1 200 OK
739− [snip]
740− < Content-Type: application/json
741− [snip]
742− {"content":"Hello\n"}
716+$ curl --verbose http://localhost:8081/myfile.txt
717+[snip]
718+* Connected to localhost (127.0.0.1) port 8081 (#0)
719+> GET /myfile.txt HTTP/1.1
720+> User-Agent: curl/7.30.0
721+> Host: localhost:8081
722+> Accept: */*
723+>
724+< HTTP/1.1 404 Not Found
725+[snip]
726+myfile.txt just isnt there, please leave this server alone.
727+
728+$ echo Hello > myfile.txt
729+
730+$ curl --verbose http://localhost:8081/myfile.txt
731+[snip]
732+* Connected to localhost (127.0.0.1) port 8081 (#0)
733+> GET /myfile.txt HTTP/1.1
734+> User-Agent: curl/7.30.0
735+> Host: localhost:8081
736+> Accept: */*
737+>
738+< HTTP/1.1 200 OK
739+[snip]
740+< Content-Type: application/json
741+[snip]
742+{"content":"Hello\n"}
743743```
744744
745745## Response headers