A simple trade API project with CRUD operations, authentication using JWT, and powered by Golang, Gin, MySQL, and GORM.
This API is developed using Golang, Gin web framework, GORM for database operations, and JWT for authentication.
Before running the program, make sure you've installed the required dependencies.
- Install Golang: Official Golang Installation Guide
- Install Gin:
go get github.com/gin-gonic/gin
- Install GORM:
go get gorm.io/gorm
- Install MySQL driver for GORM:
go get gorm.io/driver/mysql
- Install JWT library:
go get github.com/dgrijalva/jwt-go
Create your MySQL database and update the database configuration in the project.
go run main.go
Method | URL | Description |
---|---|---|
POST | {{baseurl}}/auth/login | admin login |
POST | {{baseurl}}/auth/register | admin register |
GET | {{baseurl}}/products | get all product |
GET | {{baseurl}}/products/:uuid | get Product by id |
POST | {{baseurl}}/products | create product |
DELETE | {{baseurl}}/products/:uuid | delete product |
PUT | {{baseurl}}/products/:uuid | Update product |
GET | {{baseurl}}/products/variants | get all variants |
GET | {{baseurl}}/products/variants/:uuid | get variant by id |
POST | {{baseurl}}/products/variants | create variant |
DELETE | {{baseurl}}/products/variants/:uuid | delete variant |
PUT | {{baseurl}}/products/variants/:uuid | Update variant |