stonks

module
v0.0.0-...-f62d8aa Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 2, 2020 License: MIT

README

User Manager

This is a service responsible for managing users, providing a way to create, list and delete users through a simple to use API.

API

The reference documentation for the API can be found here.

Development

Dependencies

To run the automation provided here you need to have installed:

If you fancy building things (or running tests) with no extra layers you can install the latest Go. It can be useful to quickly run isolated tests like this:

go test -race ./...

But for running the integration tests it gets challenging since the project depends on two different databases, Redis and Postgres.

It is recommended to just use the provided automation through make, it will help you achieve consistent results.

Running tests

To run isolated tests just run:

make test

And for integration tests:

make test-integration

To check locally the coverage from all the tests run:

make coverage

And it should open the coverage analysis in your browser.

Linting

To lint code, just run:

make lint

Releasing

To create an image ready for production deployment just run:

make image

And one will be created tagged with the git short revision of the code used to build it, you can also specify an explicit version if you want:

make image version=1.12.0

Debugging

You can get an interactive shell inside the development environment running :

make shell

You will be able to test all services exported inside the environment network and some useful tools will be available to you, like psql.

Running Locally

If you want to explore a locally running version of the service integrated with all its dependencies (also locally) just run:

make run

And the service will be available at port 8080. You can test creating an user with curl for example:

curl http://localhost:8080/v1/users -X POST -d '{"fullname":"test", "email":"hi@test.com", "password":"pass"}'

Directories

Path Synopsis
Package api is responsible for exporting services as an HTTP API.
Package api is responsible for exporting services as an HTTP API.
cmd
manager
Package manager is responsible for managing users.
Package manager is responsible for managing users.
storage
Package storage is responsible for storing and retrieving users
Package storage is responsible for storing and retrieving users

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL