The purpose of this API is to understand the basic concepts of crud operations in a rest api by implementing a project for an online store. This api was also developed as a final project for a mobile programming course and will be consumed by a flutter-based frontend as part of the project.
- Golang : https://go.dev/doc/
- PostgreSQL : https://www.postgresql.org/docs/
- Fiber : https://docs.gofiber.io/
- GORM : https://gorm.io/docs/
- Fiber :
go get github.com/gofiber/fiber/v2
- GORM Postgres :
go get gorm.io/gorm gorm.io/driver/postgres
- Validator :
go get github.com/go-playground/validator/v10
- Accounting Format :
go get github.com/leekchan/accounting
- App : https://fly.io
- Database : https://railway.app
Key Feature :
- CRUD product
- List product
- Search product
- Details product
API URL : https://minicommerce.fly.dev
Request :
- description : add product
- header : multipart/form-data
- body :
- product_name : string
- img_product : byte (uploaded image)
- type_product : string
- desc : string
- sold : int
- location : string
- price : integer
- stock : integer
Response :
- status [201] created
- data :
{ "id" : "integer", "product_name" : "string", "img_product" : "byte", "type_product" : "string", "desc" : "string", "sold" : "int", "location" : "string", "price" : "integer", "stock" : "integer", "created_at" : "date" }
Request :
- description : get all products
Response :
- status [200] success
- data :
{ [ { "id" : "integer", "product_name" : "string", "img_product" : "byte", "type_product" : "string", "desc" : "string", "sold" : "int", "location" : "string", "price" : "integer", "stock" : "integer", }, { "id" : "integer", "product_name" : "string", "img_product" : "byte", "type_product" : "string", "desc" : "string", "sold" : "int", "location" : "string", "price" : "integer", "stock" : "integer", } ] }
Request :
- description : update product
- header : multipart/form-data
- params : productID(integer)
- body:
- product_name : string
- img_product : byte (uploaded image)
- type_product : string
- desc : string
- sold : int
- location : string
- price : integer
- stock : integer
Response :
- status [200] success
- data :
{ "Product":{ "id" : "integer", "product_name" : "string", "img_product" : "byte", "type_product" : "string", "desc" : "string", "sold" : "int", "location" : "string", "price" : "integer", "stock" : "integer", "created_at" : "date", "updated_at" : "date" } }
Request :
- description : delete product
- params : productID
Response :
- status [200] success
- data :
{ "message" : "product successfully deleted" }
Request :
- description : show all product to the menu
Response :
- status [200] success
- data :
{ "Products": [ { "id" : "integer", "product_name" : "string", "img_product" : "byte", "type_product" : "string", "sold" : "int", "location" : "string", "price" : "integer", "stock" : "integer" } ] }
Request :
- description : search product
- params : query paramaeter (product_name, type_product) Response :
- status [200] success
- data :
{ "product_name" : "string", "img_product" : "byte", "type_product" : "string", "sold" : "int", "location" : "string", "price" : "integer", "stock" : "integer" }
Request :
- description : detail product
- params : productID(integer)
Response :
- status [200] success
- data :
{ "product_name" : "string", "img_product" : "byte", "type_product" : "string", "sold" : "int", "location" : "string", "price" : "integer", "stock" : "integer", "desc" : "string" }
- Download and install Postman from the official website.
- Follow the installation instructions for your operating system.
- Ensure you have the
minicommerce.json
file, download or copied into your local machine.
- Open Postman.
- Click on the "Import" button in the top left corner of the Postman app.
- Select the "File" tab.
- Click on "Choose Files" and select the
minicommerce.json
file from your local machine. - Postman will import the collection, and you will see it appear in the Collections sidebar.
- Once imported, you will see the collection in the Collections sidebar.
- Click on the collection to browse through the API requests.
- Select any request and click the "Send" button to execute it and view the response.
By following these steps, you will have the API documentation and requests ready to use in Postman, making it easier to interact with the API endpoints provided in the minicommerce.json
file.