No description
Find a file
2023-06-11 12:50:33 +03:00
src README 2023-06-11 12:50:33 +03:00
.dockerignore docker 2023-06-11 01:22:34 +03:00
.env.example done with checkout + started mail 2023-06-10 01:20:42 +03:00
.gitignore generate and push are working 2023-06-08 14:05:28 +03:00
docker-compose.yaml removed unused vars 2023-06-11 01:24:50 +03:00
Dockerfile using npm to start the server 2023-06-11 01:27:51 +03:00
package-lock.json sendgrid added 2023-06-10 01:39:09 +03:00
package.json docker 2023-06-11 01:22:34 +03:00
README.md README 2023-06-11 12:50:33 +03:00
tsconfig.json generate and push are working 2023-06-08 14:05:28 +03:00

Ecomm

Description

This is a simple e-commerce backend application.

Technologies used:

  • Node.js
  • typescript
  • Express.js
  • MongoDB
  • Mongoose ORM
  • Docker (docker-compose)
  • bcrypt
  • JWT

How to run

  1. Clone the repository
  2. Make sure you have docker and docker-compose installed
  3. Implement the .env file
  4. Run docker-compose up in the root directory The application will be running on port 3000 The database will be running on port 27017

API

app.use('/products', productRouter); app.use('/cart', cartRouter);

Users

POST /users ## - Create a new user

Request body

{
    "name": "string",
    "email": "string",
    "password": "string"
}

Response body

{
    "user": {
        "_id": "string",
        "name": "string",
        "email": "string",
        "password": "string",
        "createdAt": "string",
        "updatedAt": "string",
        "__v": "number"
    },
    "token": "string"
}

POST /users/login ## - Login

Request body

{
    "email": "string",
    "password": "string"
}

Response

body

{
  "access-token": "string"
}

headers

Cookie - "access-token"": "string"

Products

GET /products ## - Get all products

accepts query params: page, limit. Default values: page = 0, limit = 50.

Response body

{
    "products": [
        {
            "_id": "string",
            "name": "string",
            "description": "string",
            "price": "number",
            "createdAt": "string",
            "updatedAt": "string",
            "__v": "number"
        }
    ],
    "total": "number"
}