mongo-api is a REST API using MongoDB, Redis, Docker and JWT.
- Uses Gin for routing
- Uses a salt to hash the password
- Uses JWT for authentication
- Uses struct separation to hide sensitive information from call responses
- Error handling
- Viper for secret management
mongo-api
requires Go 1.9+ to run.
Install the dependencies and devDependencies and start the server.
$ git clone https://github.com/morelmiles/mongo-api.git
$ cd mongo-api
$ go run main.go
For production release:
$ go build
- Write Tests
Project uses a number of open source projects to work properly:
- Gin - Implements a request router and dispatcher in Go
- MongoDB - document-based, big community, database
- Redis - in-memory database using key-value pairs
- Docker - Build, Share, and Run Any App, Anywhere
API endpoint - http://localhost:8080 Swagger endpoint - http://localhost:8080/swagger/index.html
At the root of the project
docker build -t my-app-image .
- Start the Redis and MongoDB containers
$ docker run --name my-mongo-container -d mongo
$ docker run --name some-redis -d redis