/httprouter-crud-golang-mongoDB

Golang RESTFull API with mongoDB & Redis

Primary LanguageGo

Tech Stack

Golang  Git  Redis  MongoDB 

News & Tags

This repo contains News & Tag service and also apispec & http test.

Requeirement

  • MongoDB
    • Create database name "crud"
    • Create collection "news & tags"
  • Redis

Installation

Clone this repository :

     git clone https://github.com/zidnim5/httprouter-crud-golang-mongoDB.git

Adjust database.go & redis.go in app folder

Execute command below :

     go mod init golang-mongodb
     go mod tidy

Simple way to run this service :

     make dev

Project Structure

.
├── app                     # Configuration Files
├── controller              # Controller Files
├── exception               # Exception handling Files
├── helper                  # Helper Files             
├── model                   # Model Files
|      └── domain           
|      └── web  
├── repository              # Repository Files
├── service                 # Service Files
├── apispec.json            # Service Files
├── docker-compose.yml
├── dockerfile
├── go.mod
├── go.sum
├── makefile
├── tags.http
├── news.http
└── readme.md

Database

This service using "MongoDB & Redis" to stored News & Tags data.

Endpoint

To connected to this endpoint please ensure your base_url is "localhost:3000" or you can adjust your own port in main.go file

Http Testing

You can spesific test to available http test below :

  • tags.http
  • news.http