This repository implements the design outlined in the design document. It is implemented in Go and uses the following frameworks:
Production:
- Chi: A lightweight framework for building HTTP services.
- logger: A logger framework for... logging.
- MongoDB driver: A database driver for MongoDB.
Testing:
Fetch dependencies with the command $ go get .
.
The tests are split up into unit and integration tests. Run the unit tests with the command
$ go test
and the integration tests with the integration build tag:
$ go test -tags=integration
Notice: the integration tests requires a database running. You can start this with docker-compose:
$ docker-compose up db
The application is fully configured via. environment variables:
Name | Default value | Description |
---|---|---|
PORT |
8080 | The port of the server |
HOST |
The host name used in REST-resource links. | |
MONGO_DB_DATABASE |
The database to use | |
MONGO_DB_URI |
The url to the database |
You may either build and run the application with the commands:
$ go build -o app .
$ MONGO_DB_DATABASE=test MONGO_DB_URI=mongodb://localhost ./app
This will start the server at port 8080
Alternatively you may start the api and database with the command:
$ docker-compose up