Skip to content

Vinayrk69/Uber

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Uber

User Registration Endpoint

POST /users/register

Registers a new user in the system.

Request Body

Send a JSON object with the following structure:

{
  "fullname": {
    "firstname": "John",
    "lastname": "Doe"
  },
  "email": "[email protected]",
  "password": "yourpassword"
}
  • fullname.firstname (string, required, min 3 chars)
  • fullname.lastname (string, optional, min 3 chars if provided)
  • email (string, required, must be valid email)
  • password (string, required, min 6 chars)

Responses

  • 201 Created

    • User registered successfully.
    • Returns: { "token": "<jwt_token>", "user": { ...userData } }

    Example:

    {
      "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
      "user": {
        "id": "64f1c2e7b2e8c9a1b2c3d4e5",
        "fullname": {
          "firstname": "Alice",
          "lastname": "Smith"
        },
        "email": "[email protected]"
        // ...other user fields...
      }
    }
  • 400 Bad Request

    • Validation failed.
    • Returns: { "errors": [ ... ] }

    Example:

    {
      "errors": [
        "Email is invalid",
        "Password must be at least 6 characters"
      ]
    }
  • 500 Internal Server Error

    • Unexpected error during registration.

    Example:

    {
      "error": "Internal server error"
    }

Example Request

curl -X POST http://localhost:3000/users/register \
  -H "Content-Type: application/json" \
  -d '{
    "fullname": { "firstname": "Alice", "lastname": "Smith" },
    "email": "[email protected]",
    "password": "securepass"
  }'

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages