This is a backend project for a web application. Its purpose is to provide a REST API for managing data and perfoming business logic. It`s an API to manage data of a ecommerce.
Tech-Stack • Architecture • Installation • API Reference • Deploy • Author
- Node.js
- Express.js
- MongoDB
- Joi
- Uuid
- Bcrypt
The backend project is structured as a REST API with the following components:
- Controllers: Handles incoming HTTP requests and calls the appropriate service functions.
- Middlewares: Handles authentication and request validation.
- Schemas: Defines the MongoDB schemas.
- Routes: Implements the business logic for the API.
- Clone the repository to your local machine.
- Run
npm install
to install all dependencies. - Start MongoDB locally or connect to a remote database.
- Create a
.env
file and set theDATABASE_URL
. - Run
npm start
to start the server.
Authentication:
- POST /sign-in -> payload: {email, pwd}
- POST /sign-up -> payload: {email, name, phone, pwd, repeatPwd}
- POST /sign-in-admin -> payload: {email, pwd}
Cart:
- GET /cart -> headers: {token}
- POST /cart/:idItem -> headers: {token}, payload:{quantityItem}
- PUT /cart/:idItem -> headers: {token}, payload:{quantityItem}
- DELETE /cart -> headers: {token}
- DELETE /cart/:idItem -> headers: {token}
- POST /cart-payment -> headers: {token}
Items:
- GET /items
- GET /items/:idItem
- POST /items -> payload:{nameItem, imageItem, valueItem, quantityItem}
- PUT /items/:idItem -> payload:{nameItem, imageItem, valueItem, quantityItem}
Users:
- GET /users -> headers: {token}
The API is available on Render: