This project is an example of a REST API project using the Go language and the implementation of other tools
MIT License
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.
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 |
Postman API Documentation
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
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
make docker
make cover