Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/engineerit2014/ms-gin-go
RestfulAPI Microservice with Gin Framework and the following implementations: Postgresql DB and Postgresql Migrations.
https://github.com/engineerit2014/ms-gin-go
docker-compose dockerfile gin-framework gin-gonic golang makefile migrations postgresql restful-api
Last synced: 4 days ago
JSON representation
RestfulAPI Microservice with Gin Framework and the following implementations: Postgresql DB and Postgresql Migrations.
- Host: GitHub
- URL: https://github.com/engineerit2014/ms-gin-go
- Owner: engineerit2014
- Created: 2021-03-28T16:51:49.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-04-03T02:12:46.000Z (over 3 years ago)
- Last Synced: 2024-11-15T00:33:15.285Z (about 1 month ago)
- Topics: docker-compose, dockerfile, gin-framework, gin-gonic, golang, makefile, migrations, postgresql, restful-api
- Language: Go
- Homepage: https://github.com/laironacosta/ms-gin-go
- Size: 58.6 KB
- Stars: 4
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Microservice: Gin Framework Example
This project shows the use of Gin Framework in Golang.This repository runs a simple main daemon (main) that implements a REST API for users. The daemon uses a postgres database to persist data and after creation uses migrations to create the user schema.
## Table of Contents
- [Running](#running)
- [Dependencies](#dependencies)
- [Environment Variables](#environment-variables)
- [Make Rule](#make-rule)
- [Testing](#testing)
- Coming soon## Running
### Dependencies
The only dependencies to run the services in this repository are:
- `docker`
- `docker-compose`### Environment Variables
The program looks for the following environment variables:
- `DB_USER`: The postgres database username that gets used within the postgres connection
string (Default: `root`).
- `DB_PASS`: The postgres database password that gets used within the postgres connection
string (Default: `root`).
- `DB_NAME`: The postgres database name that gets used within the postgres connection string
(Default: `user`).
- `DB_HOST`: The postgres database host name that gets used within the postgres connection
string (Default `db`).
- `DB_PORT`: The postgres database port that gets used within the postgres connection string
(Default: `5432`).If the environment variable has a supplied default and none are set within the context of the host
machine, then the default will be used.
To set any given environment variable, simply execute the following
pattern, replacing `[ENV_NAME]` with the name of the environment variable and `[ENV_VALUE]` with the
desired value of the environment variable: `export [ENV_NAME]=[ENV_VALUE]`. To unset any set environment
variable, simply execute the following pattern, replacing `[ENV_NAME]` with the name of the environment
variable: `unset [ENV_NAME]`.### Make Rule
To run the services simply execute the following command:
```shell
make run
```This will stop any containers defined by the compose file if already running
and then rebuild the containers using the compose file. The main daemon (`main`)
will be available at `localhost:8080` and the postgres instance will be available
at `localhost:5432`.To stop the services simply execute the following command:
```shell
make stop
```To down the services simply execute the following command:
```shell
make down
```## Testing
Coming soon