Skip to content
Snippets Groups Projects
Commit 216a6392 authored by Harshith Karkera's avatar Harshith Karkera
Browse files

API End points file Added

parent 2f21e271
Branches
No related tags found
No related merge requests found
API Endpoints
Run the Project : node server.js
Run the Testing : npm test
Base URL: http://localhost:3000
User APIs
Create a User
URL: http://localhost:3000/users
Endpoint: POST /users
Description: Creates a new user.
Request Body (JSON):
{
"name": "Vijay Sharma",
"email": "vijay@example.com",
"age": 25
}
Response (JSON):
{
"_id": "1234567890",
"name": "Vijay Sharma",
"email": "vijay@example.com",
"age": 25
}
---------------------------------------------------
Get All Users
URL: http://localhost:3000/users
Endpoint: GET /users
Description: Retrieves the list of all users.
Response (JSON):
[
{
"_id": "1234567890",
"name": "Vijay Sharma",
"email": "vijay@example.com",
"age": 25
},
{
"_id": "0987654321",
"name": "Sumith",
"email": "sumith@example.com",
"age": 30
}
]
-----------------------------------------------
Update a User
URL: http://localhost:3000/users/{id}
Endpoint: PUT /users/:id
Description: Updates user details by ID.
Request Body (JSON):
{
"name": "Kumar",
"age": 30
}
Response (JSON):
{
"_id": "1234567890",
"name": "Kumar",
"email": "sumith@example.com",
"age": 30
}
---------------------------------------
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment