Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/surajmendhe5573/product-upload-api
https://github.com/surajmendhe5573/product-upload-api
Last synced: 6 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/surajmendhe5573/product-upload-api
- Owner: surajmendhe5573
- Created: 2024-08-11T02:40:04.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-08-11T03:02:46.000Z (3 months ago)
- Last Synced: 2024-08-12T04:57:16.278Z (3 months ago)
- Language: JavaScript
- Size: 1.39 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Product Upload API
## Overview
This project is a RESTful API built with Express.js and MongoDB that facilitates the management of product information, including image uploads. It uses Multer for handling file uploads and ensures that necessary directories are created if they don't exist.
## Features
- **Image Uploads**: Upload multiple images (up to 10) for each product.
- **Product Management**: Create and manage product details including name, category, code, description, size, wood type, finish type, and price.
- **Retrieve Products**: Fetch a list of all products.# API Documentation
## Create a Product
### Product
- **URL:** `http://localhost:3000/api/products`
- **Method:** `POST`### Form Data
The request must be sent as `multipart/form-data` and include the following fields:- **productName** (string, required): The name of the product.
- **productCategory** (string, required): The category of the product.
- **productCode** (string, required): A unique code for the product.
- **smallDescription** (string, required): A brief description of the product.
- **detailedDescription** (string, required): A detailed description of the product.
- **productSize** (string, required): The size of the product.
- **productWoodType** (string, required): The type of wood used for the product.
- **finishType** (string, required): The type of finish applied to the product.
- **productPrice** (number, required): The price of the product.
- **images** (file, multiple, up to 10 files): Upload one or more image files of the product.## Retrieve All Products
### Description
Retrieves a list of all products from the database.
## Retrieve All Products
### Product
- **URL:** `http://localhost:3000/api/products`
- **Method:** `GET`## Set Up Environment Variables
Create a `.env` file in the root directory of your project and add your environment variables. Below is an example `.env` file:
**Example `.env` file:**
```env
MONGO_URI= mongodb://localhost:27017/defaultdb
PORT= 3000