Home »
MCQs »
FastAPI MCQs
Which of the following is a decorator used to specify a FastAPI route or endpoint?
27. Which of the following is a decorator used to specify a FastAPI route or endpoint? It is used to link a function to a certain HTTP request method (such as GET, POST, PUT, DELETE, and so on) and URL path.
- @app.router()
- @app.route_engine()
- @app.route()
Answer: C) @app.route()
Explanation:
@app.route() is a decorator used to specify a FastAPI route or endpoint. It is used to link a function to a certain HTTP request method (such as GET, POST, PUT, DELETE, and so on) and URL path.