I have a beginner-friendly FastAPI employee app with endpoints: GET /employees POST /employees GET /employees/{id} PUT /employees/{id} DELETE /employees/{id}
Help me add HTTP Basic Authentication step by step.
Requirements:
- Use FastAPI built-in HTTPBasic
- Hardcode two users:
- admin / admin123 / role=admin
- user / user123 / role=user
- Protect GET /employees so authenticated users can access it
- Protect POST, PUT, DELETE so only admin can access them
- Keep the code simple and beginner-friendly
- Explain every change
- Do not use database authentication yet
- Show the full updated code
- Show how to test in Swagger UI and Postman