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": "[email protected]","password": "pass","firstName": "Jackson","lastName": "Sabey"}' \
http://localhost:8080/signup
Body:
{
"email": "[email protected]",
"password": "pass",
"firstName": "Jackson",
"lastName": "Sabey"
}
Response:
{
"token": "jwt-token"
}
Request:
curl --header "Content-Type: application/json" \
--request POST \
--data '{"email": "[email protected]","password": "pass"}' \
http://localhost:8080/login
Body:
{
"email": "[email protected]",
"password": "pass"
}
Response:
{
"token": "jwt-token"
}
Request:
curl --header "X-Authentication-Token: jwt-token" \
http://localhost:8080/users
Response:
{
"users": [
{
"email": "[email protected]",
"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