Gathering detailed insights and metrics for edu-crud-api
Gathering detailed insights and metrics for edu-crud-api
Gathering detailed insights and metrics for edu-crud-api
Gathering detailed insights and metrics for edu-crud-api
npm install edu-crud-api
Typescript
Module System
Node Version
NPM Version
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Edu CRUD API is a basic CRUD (Create, Read, Update, Delete) API built with Express.js. It is designed as an educational tool to help developers learn about building APIs, using Node.js, handling requests, and managing data with basic CRUD operations.
To install the Edu CRUD API package, run the following command:
1npm install edu-crud-api
Here's a basic example of how to use the Edu CRUD API in your Node.js project:
1const express = require('express'); 2const app = express(); 3const eduCrudApi = require('edu-crud-api'); 4 5app.use(express.json()); 6app.use(eduCrudApi); 7 8const PORT = process.env.PORT || 3000; 9app.listen(PORT, () => { 10 console.log(`Server is running on port ${PORT}`); 11});
Edu CRUD API provides predefined routes for CRUD operations. You can use them as follows:
/items
- Retrieves a list of all items./items/:id
- Retrieves a single item by its ID./items
- Creates a new item./items/:id
- Updates an existing item by its ID./items/:id
- Partially updates an item by its ID./items/:id
- Deletes an item by its ID./items/:id
- Checks if an item exists by its ID.Endpoint: /
Method: GET
Description: Returns a welcome message.
Response:
Welcome to the CRUD API!
Endpoint: /items
Method: GET
Description: Retrieves a list of all items.
Response:
1[ 2 { 3 "id": "unique-id-1", 4 "Learn": "Item 1" 5 }, 6 { 7 "id": "unique-id-2", 8 "Learn": "Item 2" 9 } 10]
Endpoint: /items/:id
Method: GET
Description: Retrieves a single item by its ID.
Response:
1{ 2 "id": "unique-id-1", 3 "Learn": "Item 1" 4}
Endpoint: /items
Method: POST
Description: Creates a new item.
Request Body:
1{ 2 "Learn": "New Item" 3}
Response:
1{ 2 "id": "new-unique-id", 3 "Learn": "New Item" 4}
Endpoint: /items/:id
Method: PUT
Description: Updates an existing item by its ID.
Request Body:
1{ 2 "Learn": "Updated Item" 3}
Response:
1{ 2 "id": "unique-id-1", 3 "Learn": "Updated Item" 4}
Endpoint: /items/:id
Method: PATCH
Description: Partially updates an item by its ID.
Request Body:
1{ 2 "Learn": "Partially Updated Item" 3}
Response:
1{ 2 "id": "unique-id-1", 3 "Learn": "Partially Updated Item" 4}
Endpoint: /items/:id
Method: DELETE
Description: Deletes an item by its ID.
Response:
Status: 204 No Content
Endpoint: /items/:id
Method: HEAD
Description: Checks if an item exists by its ID.
Response:
Status: 200 OK (if exists) or 404 Not Found (if not exists)
If an item is not found or a bad request is made, the API will respond with an appropriate HTTP status code and message.
1{ 2 "error": "Item not found" 3}
This project is licensed under the MIT License.
You can find the repository here. You can clone the repository via git clone https://github.com/Experiencedeveloper/Edu-CRUD-API
No vulnerabilities found.
No security vulnerabilities found.