This is a Node.js API for displaying product information. Currently, it focuses on various electric gadgets, but it can be easily extended to handle other categories.
-
List Products: Retrieve a list of all available products.
-
Product Details: Get detailed information about a specific product by its ID.
-
Node.js: JavaScript runtime environment used to build the API.
-
Express.js: This will be utilized in the next project.
-
Bashgit clone https://github.com/PerezChris99/NodeJs-REST-API Use code with caution.content_copy
-
Bashcd product-apinpm install Use code with caution.content_copy
-
Bashnpm start Use code with caution.content_copy
-
The API will be running on the default port (usually 3000). You can interact with it using tools like Postman or by sending HTTP requests directly.
-
GET /products - Returns a list of all products in JSON format.
-
GET /products/:id - Returns details of a specific product with the given ID in JSON format.
Example Usage (using Postman):
-
GET Products:
-
Set the request method to GET.
-
Set the URL to http://localhost:5000/products.
-
Send the request. The response will be a JSON array containing all products.
-
-
GET Product Details:
-
Set the request method to GET.
-
Set the URL to http://localhost:5000/products/1 (replace 1 with the actual product ID).
-
Send the request. The response will be a JSON object containing details of the specified product.
-
We welcome contributions to this project! Please feel free to fork the repository and submit pull requests with your improvements.
This project is licensed under the MIT License. See the LICENSE file for more details.