GithubHelp home page GithubHelp logo

ingresse-backend's Introduction

ingresse-backend

ingresse-backend is a simple application developed as part of the selection process for Ingresse. The application was built using Go, and the Macaron framework.

ingresse-backend is a REST API with only one endpoint: /users. It implements the http verbs POST, GET, PUT and DELETE.

ingresse-backend uses MongoDB for data persistence.

Setting up

Since Go is not a major programming language yet, not everyone has a set up environment for it, so two options are available:

  • Run natively (requires Go environment installed)
  • Run under Docker (visual representation of code coverage not available)

Running natively

Assuming a working Go environment (it's critical that the GOPATH environment variable is set according to the guidelines), run:

go get -v github.com/PhillBeck/ingresse-backend/...
cd $GOPATH/src/github/PhillBeck/ingresse-backend

Then you have to set up the infrastructure. As mentioned above, ingresse-backend requires a MongoDB instance running on port 27017. For ease of use, a docker-compose file is provided to set up Mongo:

cd docker/infrastructure
docker-compose up

after that, just navigate to the directory and execute the program:

cd $GOPATH/src/github/PhillBeck/ingresse-backend
go run main.go

Running under Docker

This assumes you have both docker AND docker-compose installed.

To run under Docker, simply clone the repository:

git clone https://github.com/PhillBeck/ingresse-backend.git

then run:

cd ingresse-backend/docker/application
docker-compose up

Using this method, the infrastructure is set up automatically.

Documentation

The repository contains the swagger file in both json and yaml formats. To access the documentation in a more friendly way, a html version is also available on the docs folder.

If you are running the application under Docker, just navigate to localhost:8000 to view the docs.

If you are running natively, you can run:

cd $GOPATH/src/github/PhillBeck/ingresse-backend/docker/docs
docker-compose up

and then access localhost:8000.

Testing

Natively

Assuming a working Go environment, just run:

cd $GOPATH/src/github/PhillBeck/ingresse-backend
go test -coverprofile=cover.prof ./...

go test will output the summary of the tests to stdout. This includes code coverage for each package. For a visual representation of the code coverage, run:

go tool cover -html=cover.prof

Under Docker

After the container is running, run:

docker exec -it ingresse-backend /bin/sh
go test -coverprofile=cover.prof ./...

Unfortunately, the visual representation of the code coverage is not available when running under Docker.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.