Skip to content

This project is an example of a REST API project using the Go language and the implementation of other tools

License

Notifications You must be signed in to change notification settings

adamnasrudin03/go-template

Repository files navigation

go-template

This project is an example of a REST API project using the Go language and the implementation of other tools, such as Auth with JWT, Basic Auth, Logger API, Cache, ORM SQL, Message Broker, Export Excel File, OTP Mechanism, Deploy with Docker, Clean Code (smell code checker by CodeScene), Unit Test, and so on.

Technology Used

Feature

Method Auth Endpoint Dec
GET no / Welcome API
POST no /api/v1/auth/sign-up Register user with role USER
POST yes /api/v1/root/auth/sign-up Register user with role USER or ADMIN, auth with super admin (root)
POST no /api/v1/auth/sign-in Login
PATCH yes /api/v1/users/:id Update User
GET yes /api/v1/users/:id Detail User
GET yes /api/v1/users List User, auth only admin or super admin (root)
PATCH yes /api/v1/users/change-password/:id Change Password
GET yes /api/v1/users/send-email-verify Send OTP Email verified
POST yes /api/v1/users/verified-email Verified email with otp
GET no /api/v1/users/request-reset-password/:id Send OTP Email forgot password
PATCH no /api/v1/users/validate-reset-password/:id Verified Reset password
GET yes /api/v1/logs List log activity history
GET yes /api/v1/logs/download Download xlx List log activity history
GET yes /api/v1/message/translate/id Translate text to language id (indonesia)
GET yes /api/v1/message/consumer Trigger manual consume queue rabbitMQ

Role

  • ROOT (role super admin) = create a user the first time the project is run, check here
  • ADMIN (role admin)
  • USER (role user)

Development Guide

Documentations

Postman API Documentation

Collection Using Postman

  • ./go-template.postman_collection.json

Installation

  • Clone this repo

        git clone https://github.com/adamnasrudin03/go-template.git
  • Copy .env.example to .env

        cp .env.example .env
  • Setup local database

  • If you using RabbitMQ, Please check or create queue for ./app/models/queue.go

  • Start service API

        go run main.go

Build project by docker

  • check ip address in terminal

        ipconfig
  • change data environment in file ./docker-compose.yml

  • build with docker compose

        docker-compose -f "docker-compose.yml" up -d --build 
    • with make file
        make docker

Coverage Unit Test

  • with make file
    make cover

Connect with me

linkedin logo

About

This project is an example of a REST API project using the Go language and the implementation of other tools

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages