There's a stack.yaml file in this directory, so you can run and build this
example project in a familiar manner.
# pull your GHC deps
stack setup
# build the project
stack build
# run the webserver
stack exec example-exeAt this point you should have a webserver running at http://localhost:8080
You'll find available endpoints at the following urls:
- http://localhost:8080/users - responds with a list of User resources
- http://localhost:8080/users/1 - responds with a singleton resource
- http://localhost:8080/users/2 - responds with a singleton resource
- http://localhost:8080/users/3 - responds with a 404 and error payload
GET /users
{
"data" : [
{
"type" : "User",
"relationships" : {
"email" : {
"links" : {
"self" : "/emails/42"
},
"data" : {
"type" : "Email",
"id" : "42"
}
}
},
"links" : {
"self" : "/users/1"
},
"meta" : null,
"id" : "1",
"attributes" : {
"userFirstName" : "Isaac",
"userLastName" : "Newton",
"userId" : 1
}
},
{
"relationships" : {
"email" : {
"links" : {
"self" : "/emails/88"
},
"data" : {
"id" : "88",
"type" : "Email"
}
}
},
"type" : "User",
"attributes" : {
"userFirstName" : "Albert",
"userLastName" : "Einstein",
"userId" : 2
},
"meta" : null,
"links" : {
"self" : "/users/2"
},
"id" : "2"
}
],
"meta" : {
"user-count" : 2
},
"links" : {
"self" : "/users"
}
}GET /users/1
{
"meta" : null,
"data" : {
"id" : "1",
"attributes" : {
"userFirstName" : "Isaac",
"userId" : 1,
"userLastName" : "Newton"
},
"meta" : null,
"links" : {
"self" : "/users/1"
},
"type" : "User",
"relationships" : {
"email" : {
"links" : {
"self" : "/emails/42"
},
"data" : {
"id" : "42",
"type" : "Email"
}
}
}
},
"links" : {
"self" : "/users/1"
}
}GET /users/3
{
"error":{
"status":"404",
"code":null,
"id":null,
"meta":null,
"title":"Resource Not Found",
"links":null,
"detail":"There is no User with id: 3"
},
"meta":null,
"links":{
"self":"/users/3"
}
}