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.exampleand rename to.env, then configure your credentials. -
Install dependencies by running
go mod tidyon your terminal. -
Run command:
go run main.goto start the server onlocalhost:3000-. run commandgo test ./controller/ -coverto run unit testing
There are 4 basic HTTP requests that you can use in this API:
POSTCreate a resourcePUTUpdate a resourceGETGet a resource or list of resourcesDELETEDelete 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:
200OKThe request was successful400Bad RequestThere was a problem with the request (security, malformed)401UnauthorizedThe supplied API credentials are invalid403ForbiddenThe credentials provided do not have permissions to access the requested resource404Not FoundAn attempt was made to access a resource that does not exist in the API500Server ErrorAn error on the server occurred
