In Flask, it is possible to assign an arbitrary function to a route functionally like:
from flask import Flask
app = Flask()
def say_hello():
return "Hello"
app.add_url_rule('/hello', 'say_hello', say_hello)
which is equal to (with decorators):
@app.route("/hello")
def say_hello():
return "Hello"
Is there such a simple and functional way (add_url_rule) in FastAPI?