Skip to content

facilittei/ecomm

Repository files navigation

Ecomm

Responsible for managing payments with third-party providers.

Getting started

Commands used to build and run the application can be found in Makefile.

E.g. the application can be started by running make compose/up. You can check by visiting port 4000 on your browser.

Development

Monitoring

Application monitoring is done with Prometheus.

http://localhost:9090

The endpoint that Prometheus scrapes is http://localhost:4000/metrics

Visualization

Application metrics can be visualized with Grafana.

http://localhost:3000

Default login: admin/admin

Testing

We use Testify as our testing library in conjunction with the standard library from Go.

This library also provides Mock capabilities and in order to auto-generate interfaces we can use Mockery

You can create all mocks by running go generate ./... and the files that has the annotation below, they'll be automatically generated.

//go:generate mockery --name=HttpClient --output ./../../mocks/ --filename http_client.go --structname HttpClientMock

If you want to generate a specific Mock from an interface go to the interface folder and run:

E.g.

cd internal/commmunications/http
mockery --name=HttpClient --output ./../../mocks/ --filename http_client.go --structname HttpClientMock

This command will generate a mock for our tests.

Usage:

httpClient := &mocks.HttpClientMock{}
httpClient.On("Post").Return(nil, nil)

Migrations

Our database version control is done with go-migrate.

There are a couple of ways of installing it, and homebrew is one of them:

brew install golang-migrate

Every change to the database schema must be done through the usage of this tool.

Usage:

migrate create -seq -ext=.sql -dir=./migrations create_charges_table

Applying migration:

export DSN='postgres://facilittei:4321@localhost/facilittei?sslmode=disable'
migrate -path ./migrations -database ${DSN} up

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages