Skip to content

raul-ra/backend-API-REST

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

REST API * CRUD * App

This repository contains the code for a simple Products App. The app allows you to manage brands and products associated with those brands. It provides basic CRUD (Create, Read, Update, Delete) operations for both brands and products.

Puedes ejecutar la colección de Postman haciendo clic en el siguiente botón:

Run in Postman

Table of Contents

Getting Started

Prerequisites

Before you begin, make sure you have the following prerequisites installed:

Installation

  1. Clone the repository:

    git clone <repository-url>
    
  2. Install the required dependencies:

    npm install
    
  3. Start the server:

    npm start
    
  4. The server will start running at http://localhost:8000/.

Database Schema

The app uses a MySQL database with two tables: brands and products. Here is the schema:

Brands:

id (Primary Key)
brand_name (String)

Products:

id (Primary Key)
product_name (String)
description (Text)
price (Decimal)
stock (Integer)
brands_id (Foreign Key referencing brands.id)

API Endpoints

Brands

GET /brand: Get all brands.
GET /brand/:id: Get a brand by ID.
GET /brand/:id/brandproducts: Get products by brand ID.
POST /brand: Create a new brand.
PUT /brand/:id: Update a brand by ID.
DELETE /brand/:id: Delete a brand by ID.

Products

GET /products: Get all products.
GET /products/:id: Get a product by ID.
POST /products: Create a new product.
PUT /products/:id: Update a product by ID.
DELETE /products/:id: Delete a product by ID.

Testing

The repository includes unit tests for the API endpoints. You can run the tests using the following command:

 ```sh
npm test

Happy coding!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%