mkvasconcelos / ecommerce-back

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Backend Ecommerce

About

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-StackArchitectureInstallationAPI ReferenceDeployAuthor

Tech-Stack

  • Node.js
  • Express.js
  • MongoDB
  • Joi
  • Uuid
  • Bcrypt

Architecture

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.

Installation

  1. Clone the repository to your local machine.
  2. Run npm install to install all dependencies.
  3. Start MongoDB locally or connect to a remote database.
  4. Create a .env file and set the DATABASE_URL.
  5. Run npm start to start the server.

API Reference

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}

Deploy

The API is available on Render:

Author



About


Languages

Language:JavaScript 99.7%Language:Shell 0.3%