Ask the FastAPI docs
Answers come only from the official FastAPI documentation, with links to the sections they used.
Ask
How do I enable CORS?
Run code on startup and shutdown
Return a 404 error from my endpoint