Skip to content

budde377/form3

Repository files navigation

Form3 coding exercise

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:

  • Ginkgo: A TDD/UDD framework
  • Gomega: An elaborate testing framework.

Setup

Fetch dependencies with the command $ go get ..

Testing

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

Configuration

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

Running

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published