tutorial: formatting for bash sections

This commit is contained in:
Sönke Hahn 2016-02-28 22:21:04 +01:00
parent 00c9190fe6
commit 624e220450

View file

@ -594,11 +594,11 @@ app2 = serve personAPI server4
And we're good to go: And we're good to go:
``` bash ``` bash
$ curl http://localhost:8081/persons $ curl http://localhost:8081/persons
[{"lastName":"Newton","firstName":"Isaac"},{"lastName":"Einstein","firstName":"Albert"}] [{"lastName":"Newton","firstName":"Isaac"},{"lastName":"Einstein","firstName":"Albert"}]
$ curl -H 'Accept: text/html' http://localhost:8081/persons $ curl -H 'Accept: text/html' http://localhost:8081/persons
<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> <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>
# or just point your browser to http://localhost:8081/persons # or just point your browser to http://localhost:8081/persons
``` ```
## The `ExceptT ServantErr IO` monad ## The `ExceptT ServantErr IO` monad
@ -712,33 +712,33 @@ server6 = do
Here's how that server looks in action: Here's how that server looks in action:
``` bash ``` bash
$ curl --verbose http://localhost:8081/myfile.txt $ curl --verbose http://localhost:8081/myfile.txt
[snip] [snip]
* Connected to localhost (127.0.0.1) port 8081 (#0) * Connected to localhost (127.0.0.1) port 8081 (#0)
> GET /myfile.txt HTTP/1.1 > GET /myfile.txt HTTP/1.1
> User-Agent: curl/7.30.0 > User-Agent: curl/7.30.0
> Host: localhost:8081 > Host: localhost:8081
> Accept: */* > Accept: */*
> >
< HTTP/1.1 404 Not Found < HTTP/1.1 404 Not Found
[snip] [snip]
myfile.txt just isnt there, please leave this server alone. myfile.txt just isnt there, please leave this server alone.
$ echo Hello > myfile.txt $ echo Hello > myfile.txt
$ curl --verbose http://localhost:8081/myfile.txt $ curl --verbose http://localhost:8081/myfile.txt
[snip] [snip]
* Connected to localhost (127.0.0.1) port 8081 (#0) * Connected to localhost (127.0.0.1) port 8081 (#0)
> GET /myfile.txt HTTP/1.1 > GET /myfile.txt HTTP/1.1
> User-Agent: curl/7.30.0 > User-Agent: curl/7.30.0
> Host: localhost:8081 > Host: localhost:8081
> Accept: */* > Accept: */*
> >
< HTTP/1.1 200 OK < HTTP/1.1 200 OK
[snip] [snip]
< Content-Type: application/json < Content-Type: application/json
[snip] [snip]
{"content":"Hello\n"} {"content":"Hello\n"}
``` ```
## Response headers ## Response headers