- Install Node.js version 14.17.6
- Install dependencies
cd <project_name>
npm install
- Build and run the project
npm start
Note: Database credentials are temporary, I will revoke the access once assigenment evaluation is completed
-
Create a login api with auth.
-
Create a registration api (first name, last name, email, password, mobile no, address)
(Please use hash and salt for password)
-
List api for all users with token and pagination
-
Update user details api with token
-
Search api on (first name, last name, email, mobile no) single key with token and pagination
Endpoint: http://localhost:3000/api/signup
{
"firstname":"Rajeswar",
"lastname":"Sharma",
"email":"rajeswar.sh47@gmail.com",
"phone":"7002709179",
"password1":"123",
"password2":"123",
"addressline1":"Delhi",
"addressline2":"Delhi",
"state":"Delhi",
"postal_code":"110001"
}firstname, lastname, email, phone, password1, password2, addressline1, state, postal_code
Endpoint: http://localhost:3000/api/login
{
"email":"rohit@gmail.com",
"password":"123"
}*Required fields: All
*Note: On successful login this API returns a jwt token, which is required in the header inorder access the athenticated routes and APIs.
Endpoint: http://localhost:3000/api/update-details
{
"email":"mohit12@gmail.com",
"phone":"6111111112",
"firstname":"Vishal",
"lastname":"Kumar",
"addressline1":"address",
"addressline2":"Noida",
"state":"UP",
"postal_code":"123456"
}*Note: This API updates the user details according to the authentication token
Endpoint: http://localhost:3000/api/search?
1. key: email / firstname / lastname / phone
2. page: An integer value to navigate through pages
{
"status": true,
"requested_page": "1 / 1",
"max_pages": 1,
"payload": [
{
"_id": "6266de2f0b6f0ba496868e0d",
"firstname": "Rajeswar",
"lastname": "Sharma",
"email": "rjqwer47@gmail.com",
"phone": "1234567890"
}
]
}