You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
ken 67de53684d servant example 3 months ago
app servant example 3 months ago
flyway servant example 3 months ago
nix servant example 3 months ago
src servant example 3 months ago
test servant example 3 months ago
.gitignore servant example 3 months ago
CHANGELOG.md servant example 3 months ago
Dockerfile servant example 3 months ago
LICENSE servant example 3 months ago
Makefile servant example 3 months ago
README.md servant example 3 months ago
Setup.hs servant example 3 months ago
default.nix servant example 3 months ago
docker-compose.yml servant example 3 months ago
servant-example.cabal servant example 3 months ago
shell.nix servant example 3 months ago

README.md

servant-example

Start Database

docker-compose up

Start application with Nix

nix-shell --pure

make build

make run

Interact with the application

Create a customer

curl -X POST -H "Content-Type: application/json" \
 -d '{"email":"customer@email.com","password":"123password"}' \
 http://localhost:8080/api/customer/registerCustomer

# This endpoint will respond with an id {"id":"1376fbef-6832-4de0-9839-49f615e0c6d1"}

Login as a customer

curl -X POST -H "Content-Type: application/json" \
 -d '{"email":"customer@email.com","password":"123password"}' \
 http://localhost:8080/login

# This endpoint will respond with this json body
# {"token": <JWT Token>
# ,"firstName":null
# ,"lasttName":null
# ,"email":"customer@email.com"
# }

The JWT received from /login is needed to interact with the protected endpoint. For example

curl -X GET -H "Content-Type: application/json" \
 -H "Authorization: Bearer <token>" \
 http://localhost:8080/api/customer/getCustomerByEmail/customer@email.com