/go-mongodb-rest-api-crud

A simple CRUD example of Docker REST API with Golang, MongoDB and Nginx

Primary LanguageGoMIT LicenseMIT

A simple golang app - REST API CRUD connected to a NOSQL MongoDB Database and protected behind a NGINX proxy

Introduction

Feel free to use, comment and contribute

Instructions

Create a swarm (Docker Swarm Cheatsheet). You do this by running:

docker swarm init

To start the Docker services stack in a Docker Swarm cluster, I use the following command:

docker stack deploy -c docker-stack.yml myapp

How to use

Check app health:

curl -k -H "Content-Type: application/json" http://<your ip:port>/health

Store new flight:

curl -k -d '{"flightNum":"LA8781", "airline":"TAM", "airport":"Confins", "status":"Confirmed", "expected":"20180713083500", "confirmed":"20180713083500"}' -H "Content-Type: application/json" -X POST http://<your ip:port>/flights

Get all flights:

curl -k -X GET http://<your ip:port>/flights