Retail Store Ecommerce API
Retail Store API, a simple minimalistic ecommerce REST API written in Golang and built with Echo, Gorm, and MySQL, showcasing five major functionalities:
- Authentication (Register and Login User)
- Products listing, and products listing by category
- Shopping cart feature (add and delete products)
- Order placements and payment transaction
- Access restrictions (User and, Admin only routes)
To get started, ensure that you have the following installed on your local machine:
-
Clone repository or clone your own fork
git clone https://https://github.com/nurjamil/retail_store_api.git
-
Make a duplicate of
.env.example
and rename to.env
, then configure your credentials. -
Install dependencies by running
go mod tidy
on your terminal. -
Run command:
go run main.go
to start the server onlocalhost:3000
-. run commandgo test ./controller/ -cover
to run unit testing
There are 4 basic HTTP requests that you can use in this API:
POST
Create a resourcePUT
Update a resourceGET
Get a resource or list of resourcesDELETE
Delete a resource
Each response will include a code(repsonse code),message,status and data object that can be single object or array depending on the query.
Each response will be returned with one of the following HTTP status codes:
200
OK
The request was successful400
Bad Request
There was a problem with the request (security, malformed)401
Unauthorized
The supplied API credentials are invalid403
Forbidden
The credentials provided do not have permissions to access the requested resource404
Not Found
An attempt was made to access a resource that does not exist in the API500
Server Error
An error on the server occurred