Skip to content

The InStock backend is a RESTful API built with Node.js, Express.js, and MySQL. It manages warehouses and inventory with CRUD operations, validation, and error handling. Using Knex.js for database interaction, it supports environment-based configuration, migrations, and seed data.

Notifications You must be signed in to change notification settings

Martikk/warehouse-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

warehouse-backend

Welcome to the official video repository of Warehouse . Visit the video link: Warehouse-Instock.

Dreamy Dates Website Dreamy Dates Website

Table of Contents

Introduction

The InStock backend is a RESTful API designed to manage warehouses and inventory items. It provides endpoints for CRUD operations on warehouses and inventory, with validation and error handling mechanisms.

Features

  • CRUD operations for warehouses and inventory items.
  • Validation for request bodies.
  • Error handling for common scenarios.
  • Environment variable configuration for database and server settings.

Technologies Used

  • Node.js
  • Express.js
  • Knex.js
  • MySQL (using mysql2 package)
  • dotenv for environment variables
  • validator for email validation
  • nodemon for development

Installation

  1. Clone the repository:
    git clone https://github.com/yourusername/instock-backend.git
    cd instock-backend
    1. Install dependencies:
    npm install

Environment Variables

Create a .env file in the root directory and configure the following variables:

PORT=3000
DB_HOST=localhost
DB_USER=root
DB_PASSWORD=password
DB_NAME=your_database

API Endpoints

Warehouse Endpoints

  • GET /api/warehouses: Retrieve all warehouses.
  • GET /api/warehouses/ : Retrieve a specific warehouse by ID.
  • POST /api/warehouses: Create a new warehouse.
  • PUT /api/warehouses/ : Update an existing warehouse by ID.
  • DELETE /api/warehouses/ : Delete a warehouse by ID.
  • GET /api/warehouses/
  • /inventories: Retrieve inventories for a specific warehouse.
  • Inventory Endpoints GET /api/inventories: Retrieve all inventory items.
  • GET /api/inventories/ : Retrieve a specific inventory item by ID.
  • POST /api/inventories: Create a new inventory item.
  • PUT /api/inventories/ : Update an existing inventory item by ID.
  • DELETE /api/inventories/ : Delete an inventory item by ID.

Database Migrations and Seeds

To run migrations:

npx knex migrate:latest

To run seeds:

npx knex seed:run

About

The InStock backend is a RESTful API built with Node.js, Express.js, and MySQL. It manages warehouses and inventory with CRUD operations, validation, and error handling. Using Knex.js for database interaction, it supports environment-based configuration, migrations, and seed data.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published