Try Registering a User
Exit

Try Registering a User

Test the registration endpoint with a curl command

💻

Writing code and entering commands is only available on desktop. Open this page on a larger screen to complete this chapter.

Test the registration endpoint

The registration endpoint accepts a JSON body with email and password. It returns the user's identifier and email — but never the password hash. This is intentional. The hash is stored in the database, but it should never leave the server.

The curl command sends a POST request with a JSON body to POST /register. The -H flag sets the Content-Type header, and the -d flag provides the request body:

curl -X POST http://localhost:8000/register \
  -H "Content-Type: application/json" \
  -d '{"email": "bob@example.com", "password": "mypassword"}'

Instructions

Register a new user. Use the same curl structure from the example above, but change the email to alice@example.com and the password to secret123.

  1. Run the curl command to send a POST request to http://localhost:8000/register with email alice@example.com and password secret123.