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 2 years ago
app servant example 2 years ago
flyway servant example 2 years ago
nix servant example 2 years ago
src servant example 2 years ago
test servant example 2 years ago
.gitignore servant example 2 years ago
CHANGELOG.md servant example 2 years ago
Dockerfile servant example 2 years ago
LICENSE servant example 2 years ago
Makefile servant example 2 years ago
README.md servant example 2 years ago
Setup.hs servant example 2 years ago
default.nix servant example 2 years ago
docker-compose.yml servant example 2 years ago
servant-example.cabal servant example 2 years ago
shell.nix servant example 2 years 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