This API was built in order to learn Nest.JS and Typescript. It is a simple eshop api that handles products and orders and its CRUD operations.
-
Clone this repo locally
-
Setup your environment variables:
MONGO_URI=<URL_OF_MONGO_DATABASE> JWT_SECRET=<A_SECRET_PHRASE> ENCRYPT_JWT_SECRET=<A_SECRET_PHRASE> JWT_EXPIRATION=<A_TIME_YOU_WANT>
-
Run
npm install
and thennpm run start
- Nest.JS (Typescript)
- MongoDB and Mongoose (Database)
- Swagger (API Documentation)
- (POST)
/user
: Add a new user - (POST)
/user/verify-email
: Verify user's email - (POST)
/user/login
: Login user - (POST)
/user/refresh-access-token
: Refresh an expired access token - (POST)
/product
: Create a new product - (GET)
/product
: Get all Products - (GET)
/product/{id}
: Get a specific Product - (PATCH)
/product/{id}
: Update a specific Product - (DELETE)
/product/{id}
: Delete a specific Product - (POST)
/order
: Create a new order - (PATCH)
/order/{id}
: Update a specific order - (DELETE)
/order/{id}
: Delete a specific order - (GET)
/order
: Get All orders - (GET)
/order/{id}
: Get a specific order - (GET)
/order/get/userorders/{id}
: Get the orders of a user - (GET)
/order/get/totalSales
: Get total sales from all orders - (GET)
/order/get/count
: Get total number of orders