Skip to content

Latest commit

 

History

History
70 lines (50 loc) · 1.17 KB

README.md

File metadata and controls

70 lines (50 loc) · 1.17 KB

Running the Example

You can run the example by following these steps:

    1. Install Dependencies
npm install
    1. Set Environment Variables Create a .env file in the root directory of the project and add the following environment variables:
DB_URI=
PORT=5000
    1. Start the Server
npm run dev

Example Postman Requests

Create User

  • Method: POST

  • URL: http://localhost:5000/users

  • Body: (JSON)

    {
      "name": "John Doe",
      "email": "[email protected]",
      "age": 30
    }

Get All Users

  • Method: GET
  • URL: http://localhost:5000/users

Get User by ID

  • Method: GET
  • URL: http://localhost:5000/users/{id}
  • Replace {id} with the actual user ID obtained from the create user response.

Update User by ID

  • Method: PUT

  • URL: http://localhost:5000/users/{id}

  • Body: (JSON)

    {
      "name": "Jane Doe",
      "email": "[email protected]",
      "age": 25
    }

Delete User by ID

  • Method: DELETE
  • URL: http://localhost:5000/users/{id}
  • Replace {id} with the actual user ID obtained from the create user response.