
Create FAST API
Prompt
Write a FastAPI endpoint for user login with the following requirements: 1. POST endpoint at /login 2. Accepts email and password in the request body 3. Validates that the email is in proper email format 4. Looks up the user in a SQL database (assume a table called "users" with columns: id, email, hashed_password) 5. Verifies the password against the stored hashed password 6. Returns a JWT token on successful login 7. Returns appropriate error messages for: invalid email format, user not found, and wrong password Include the SQL table schema and any necessary imports. Write production-quality code with proper error handling.
Drag to resize
Drag to resize
Drag to resize