Diagram - Chapter 5. Practice Project: Creating a REST API with AI
See
Chapter 5. Practice Project: Creating a REST API with AI
Database
UserModel
API
Client
Database
UserModel
API
Client
User Creation Flow
{email, password}
User Login Flow
{email, password}
POST /api/users
createUser(data)
Validate email format
Check if email exists
Email status
Validate password
Hash password
Insert user
User created
Return user (without password)
201 Created
POST /api/auth/login
authenticateUser(data)
Get user by email
User data
Verify password
Return authenticated user
200 OK with token