Mentioning the Cabal file explicitly, how to make Stackage LTS play nice.
This commit is contained in:
parent
75da1a1b4b
commit
b4aad4fa91
2 changed files with 11 additions and 4 deletions
|
@ -8,7 +8,15 @@ type. Can we have a webservice already?
|
||||||
Equipped with some basic knowledge about the way we represent APIs, let's now
|
Equipped with some basic knowledge about the way we represent APIs, let's now
|
||||||
write our first webservice.
|
write our first webservice.
|
||||||
|
|
||||||
The source for this tutorial section is a literate haskell file, so first we
|
## Setting up our project
|
||||||
|
|
||||||
|
Don't forget to look at the [cabal file included with this example project](tutorial.cabal). You can run the main function provided in the following examples within the `Server` module without using a separate executable.
|
||||||
|
|
||||||
|
If you're using Stack, then in your `stack.yaml` you may want to specify version 0.11.1.1 for `aeson`, and version 0.5 for `servant` and `servant-server` in your `extra-deps`.
|
||||||
|
|
||||||
|
## Writing our Server
|
||||||
|
|
||||||
|
The source for this tutorial section is a literate haskell file. To start our Server module, we
|
||||||
need to have some language extensions and imports:
|
need to have some language extensions and imports:
|
||||||
|
|
||||||
``` haskell
|
``` haskell
|
||||||
|
@ -151,7 +159,7 @@ main = run 8081 app1
|
||||||
You can put this all into a file or just grab [servant's
|
You can put this all into a file or just grab [servant's
|
||||||
repo](http://github.com/haskell-servant/servant) and look at the
|
repo](http://github.com/haskell-servant/servant) and look at the
|
||||||
*doc/tutorial* directory. This code (the source of this web page) is in
|
*doc/tutorial* directory. This code (the source of this web page) is in
|
||||||
*doc/tutorial/Server.lhs*.
|
*doc/tutorial/Server.md*.
|
||||||
|
|
||||||
If you run it, you can go to `http://localhost:8081/users` in your browser or
|
If you run it, you can go to `http://localhost:8081/users` in your browser or
|
||||||
query it with curl and you see:
|
query it with curl and you see:
|
||||||
|
|
|
@ -14,11 +14,10 @@ library
|
||||||
, Client
|
, Client
|
||||||
, Docs
|
, Docs
|
||||||
, Javascript
|
, Javascript
|
||||||
, Server
|
|
||||||
build-depends: base == 4.*
|
build-depends: base == 4.*
|
||||||
, base-compat
|
, base-compat
|
||||||
, text
|
, text
|
||||||
, aeson
|
, aeson >= 0.11 && < 0.12
|
||||||
, aeson-compat
|
, aeson-compat
|
||||||
, blaze-html
|
, blaze-html
|
||||||
, directory
|
, directory
|
||||||
|
|
Loading…
Reference in a new issue