download deps to the local cache
go mod download
run docker-compose with a build switch
docker-compose up -d --build
run migrations
goose postgres "user=sortren password=sortren123 dbname=main sslmode=disable" up
(same credentials as in .env file)
restart event-log docker container
The main endpoints are:
[GET]/api/v1/events?type=login&start=2022-07-03T21:00:00&end=2022-07-03T22:00:00&limit=10&offset=5
Which allows the user to retrieve the list of events that match the particular queryparams. More details are in the section "Detailed API Documentation"
[POST]/api/v1/events
{
"type": "login",
"description": "User has logged in to the auth service"
}
Which allows the user to send and store the event in the database via HTTP REST request
I have used the Swagger (OpenAPI), to get auto-generated docs of controllers/endpoints
To display the docs, after running up the server, get to the endpoint:
/api/v1/docs
You can easily check what is the expected request body or what are the expected arguments of the particular endpoint
If you want to test the REST API Layer, I have added the postman collection that includes every defined endpoint with sample data.