A lightweight restful API built with Node.js and Express to manage electronic product inventories.
This application allows users to create, read, update, and delete product records efficiently.
productInventory/ ├── server.js ├── package.json ├── Controllers/ │ ├── products.js │ └── Routes_handlers.js ├── node_modules/ ├── .env ├── .gitignore
- Fetch all products or a single product by ID
- Add new products to the inventory
- Update existing product details
- Delete products by ID
- Structured controller logic for clean and maintainable code
- Environment variable support with dotenv
- Auto-restart during development using nodemon
git clone https://github.com/FeoseChiki/productInventory.git
cd productInventory
npm install
Create a .env file in the project root and add:
PORT=3000
npm run dev
Visit:
| Method | Endpoint | Description |
|---|---|---|
| GET | /products |
Fetch all products |
| GET | /products/:id |
Fetch a specific product |
| POST | /products |
Add a new product |
| PATCH | /products/:id |
Update product details |
| DELETE | /products/:id |
Delete a product by ID |
[ { "id": 1, "name": "Laptop", "price": 1500, "inStock": true }, { "id": 2, "name": "Smartphone", "price": 800, "inStock": false } ]
{ "id": 3, "name": "Headphones", "price": 200, "inStock": true }
You can test the endpoints using Postman or curl.
http://localhost:3000/products
4. For POST and PATCH requests, go to the Body tab → select raw → choose JSON, then enter sample data:
{ "name": "Keyboard", "price": 120, "inStock": true }
This project is licensed under the ISC License.
Developed by Feose Chiki, Emmanuel Olayemi, Simeni Oyinuah, Ekwem Chidumaga, Ofosu Stephen, Yakubu Momohjimoh, Quarcoo Daniel, John Bamikole, Khalilulah Tajudeen, Andrews Osei
As part of our group project under BeTechified Africa.