Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bohdan-mykhailenko/api_inventory-app
An API for the inventory app with database and files storage.
https://github.com/bohdan-mykhailenko/api_inventory-app
express nodejs postgresql sequelize socket-io
Last synced: 7 days ago
JSON representation
An API for the inventory app with database and files storage.
- Host: GitHub
- URL: https://github.com/bohdan-mykhailenko/api_inventory-app
- Owner: bohdan-mykhailenko
- Created: 2023-09-07T06:55:10.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-11-02T12:47:43.000Z (over 1 year ago)
- Last Synced: 2024-12-03T03:20:21.185Z (2 months ago)
- Topics: express, nodejs, postgresql, sequelize, socket-io
- Language: TypeScript
- Homepage: https://inventory-backend-mu.vercel.app
- Size: 3.3 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Inventory API
## Overview
* [**Demo Link**](https://bohdan-mykhailenko.github.io/inventory/)
* [**Frontend Repo**](https://github.com/bohdan-mykhailenko/inventory)## Description
This repository contains the source code for the Inventory-API project, which serves as the backend for the inventory application. The API is based on **_Node.js_**, **_Express.js_** and **_Socket.io_**, and it interacts with a **_PostgreSQL_** database using the **_Sequelize ORM_**.
## Features
**The API provides the following features:**
- **Get data:** Get orders and products with certain criteria.
- **Post data:** Create a new order or product.
- **Delete data**: Delete any required order or product.
- **Count active sessions:** Using the web-socket server the app count sessions.**Additional features:**
- **Image upload:** Store image files and use the static feature.
- **Filtering:** Filtering products and orders by query or type(for products).## Technologies
- [TypeScript](https://www.typescriptlang.org/)
- [Node.js](https://nodejs.org/en)
- [Express](https://expressjs.com/)
- [Socket.io](https://socket.io/)
- [Sequelize](https://sequelize.org/)
- [Sequelize CLI](https://sequelize.org/docs/v7/cli/)
- [PostgreSQL](https://www.postgresql.org/)
- [Multer](https://github.com/expressjs/multer)## Getting Started
To get started with the Online-Store-API, follow these steps:
1. Clone the repository:
```shell
https://github.com//inventory-backend.git
```2. Install dependencies:
```shell
npm install
```3. Set up PostgreSQL Database:
- Open the **database/config.ts** file and add your PostgreSQL database configuration.```
export const config = {
DB_HOST: 'host',
DB_NAME: 'name',
DB_USERNAME: 'username',
DB_PASSWORD: 'password',
};
```4. Run migrates:
```shell
npm run migrate
```5. Run seeds:
```shell
npm run seeds
```6. Start the server:
```shell
npm run dev
```## Endpoints
The base URL for the API is: **https://inventory-backend-production-324c.up.railway.app**
Method
Endpoint
Description
Body
Products
GET
/products/:productId
Get product with certain id.
NULL
GET
/products?query=query&type=type
Get all products with filtering by query and type
NULL
GET
/products/order/orderId
Get all products for certain order.
NULL
POST
/products
Create new product with all required fields connected to existed order.
{
serialNumber: string,
isNew: boolean,
isRepairing: boolean,
photo: Blob,
title: string,
type: string,
specification: string,
guarantee: JSON.Stringify({
start: string,
end: string,
}),
price: JSON.Stringify({
value: number,
symbol: string,
isDefault: number,
},
{
value: number,
symbol: string,
isDefault: number,
});
date: string,
}
DELETE
/products/:productId
Delete product with certain id.
NULL
Orders
GET
/orders/:orderId
Get orderwith certain id.
NULL
GET
/orders?query=query
Get all orders filtering by query.
NULL
POST
/orders
Create new order with all required fields.
{
title: string,
date: string,
description: string,
}
DELETE
/orders/:orderId
Delete order with certain id and all connected products.
NULL