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.
- Run the
curlcommand to send a POST request tohttp://localhost:8000/registerwith emailalice@example.comand passwordsecret123.
Interactive Code Editor
Sign in to write and run code, track your progress, and unlock all chapters.
Sign In to Start Coding