Skip to content

Hadyaziz05/rescounts-interview-task

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

rescounts-interview-task

About

A simple e-commerce Go web application that handles authentication for users as well as creation, updating, listing, and deleting products.

Setup

  • Git clone this repository
  • Install pgAdmin4
  • cd into the directory then run go run main.go

Authentication

A user can login with their credentials using

POST /users/login
{
  "Email": "XXXXX",
  "Password: "YYYYY",
}

A user can sign up with their credentials using

POST /users/signup
{
  "Name": "AAAAAA",
  "Email": "XXXXX",
  "Password: "YYYYY",
  "Admin": false,
}

Users passwords are hashed before being inserted into the database

Viewing Products

All users are allowed to see the list of products stored in the database and to buy via Stripe

List
GET /products
Buy 
POST/api/charges/{id}
{
  "amount": 200,
  "receiptEmail": "XXXXX" 
}

Managing Products

Admin users are allowed to add, remove, edit products existing in the database using the following endpoints

Create
POST /products
{
    "Name": "pen",
    "Quantity": 20,
    "Price": 200
}
Edit
PUT /products/{id}
{
    "Name": "pen",
    "Quantity": 20,
    "Price": 200
}
Delete
DELETE /products/{id}

These endpoints are protected via JWT middleware.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages