Test the Create User Endpoint

Start the server and use Postman or Bruno to send a POST request.

Endpoint:

POST http://localhost:3000/api/v1/users

Headers:

Content-Type: application/json

Request body:

{
  "name": "John Doe",
  "email": "john@example.com",
  "password": "temporary-password",
  "age": 25
}

At this stage, password hashing has not yet been implemented. Use only a disposable local database for this intermediate test, and do not expose this endpoint publicly. We will secure registration before completing authentication.

Temporary Development Step

Do not deploy the initial registration endpoint. Passwords must be hashed before storage, and input validation must be applied before accepting registrations.

Create User Request
POST /api/v1/users HTTP/1.1
Host: localhost:3000
Content-Type: application/json

{
  "name": "John Doe",
  "email": "john@example.com",
  "password": "temporary-password",
  "age": 25
}

Sends a JSON request to create a user. The password handling in this initial stage is intentionally incomplete and will be replaced with password hashing.

Key Takeaways
  • Test endpoints using an API client.

  • Set the Content-Type header to application/json.

  • Verify the created document in MongoDB.