Skip to content

Shawn2208/Product-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

https://productapi-mqf6.onrender.com/products

Product API

This is a simple RESTful API for managing products. It allows you to perform CRUD (Create, Read, Update, Delete) operations on products.

Table of Contents

Features

  • Create a new product
  • Retrieve all products
  • Retrieve a single product by ID
  • Update a product by ID
  • Delete a product by ID

Getting Started

Prerequisites

  • Node.js and npm installed
  • MongoDB installed locally or a MongoDB Atlas account

Installation

  1. Clone the repository:

    git clone https://github.com/Shawn2208/Product-API.git
    
    
  2. Change into the project directory:

cd product-api

  1. Install dependencies:

npm install

Environment Variables

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

  1. Replace the placeholder values with your MongoDB connection details.

PORT=3000 MONGO_URL=mongodb+srv://your-username:[email protected]/your-database

  1. Start the server:

npm start

Your API will be accessible at http://localhost:3000 (or the port specified in your .env file).

API Endpoints

GET /products: Retrieve all products.

GET /products/:id: Retrieve a single 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.

License

This project is licensed under the MIT License.

You can customize based on your specific project details. Make sure to replace placeholders with your actual information. If you have any further questions or modifications, let me know!