Requires: Postgres (edit RepositoryOpts.Addr
struct in cmd/main.go
and repo/pg_test.go
)
Build: cd cmd && go build && ./cmd
Test: go vet ./... && go test ./...
Address: http://localhost:8080/
Request:
curl --header "Content-Type: application/json" \
--request POST \
--data '{"email": "jackson@juandefu.ca","password": "pass","firstName": "Jackson","lastName": "Sabey"}' \
http://localhost:8080/signup
Body:
{
"email": "jackson@juandefu.ca",
"password": "pass",
"firstName": "Jackson",
"lastName": "Sabey"
}
Response:
{
"token": "jwt-token"
}
Request:
curl --header "Content-Type: application/json" \
--request POST \
--data '{"email": "jackson@juandefu.ca","password": "pass"}' \
http://localhost:8080/login
Body:
{
"email": "jackson@juandefu.ca",
"password": "pass"
}
Response:
{
"token": "jwt-token"
}
Request:
curl --header "X-Authentication-Token: jwt-token" \
http://localhost:8080/users
Response:
{
"users": [
{
"email": "jackson@juandefu.ca",
"firstName": "Jackson",
"lastName": "Sabey"
}
]
}
Request:
curl --header "X-Authentication-Token: jwt-token" --header "Content-Type: application/json" \
--request PUT \
--data '{"firstName": "JACKSON","lastName": "SABEY"}' \
http://localhost:8080/users
{
"firstName": "JACKSON",
"lastName": "SABEY"
}
Response:
none