Skip to content

Sortren/event-log

Repository files navigation

Event Logger

Service that allows to send and store variety of events and retrieve them from the database layer.

Technologies used:

Go

Fiber

Gorm

Postgresql

Swagger

http

http

http



How to build the service

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


General service information

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


Detailed API Documentation

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 will see smth like this: image

You can easily check what is the expected request body or what are the expected arguments of the particular endpoint
image image


Tests

If you want to test the REST API Layer, I have added the postman collection that includes every defined endpoint with sample data.


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published