title: FastAPI: Retrieve URL from view name ( route name )
body: <p>Suppose I have following views,</p>
  <pre><code>from fastapi import FastAPI
  
  app = FastAPI()
  
  
  @app.get('/hello/')
  def hello_world():
      return {&quot;msg&quot;: &quot;Hello World&quot;}
  
  
  @app.get('/hello/{number}/')
  def hello_world_number(number: int):
      return {&quot;msg&quot;: &quot;Hello World Number&quot;, &quot;number&quot;: number}
  </code></pre>
  <p>I have been using these functions in Flask and Django</p>
  <ul>
  <li><a href="https://flask.palletsprojects.com/en/master/api/#flask.url_for" rel="noreferrer">Flask: <strong><code>url_for(...)</code></strong></a></li>
  <li><a href="https://docs.djangoproject.com/en/dev/ref/urlresolvers/#reverse" rel="noreferrer">Django: <strong><code>reverse(...)</code></strong></a></li>
  </ul>
  <p>So, how can I obtain/build the URLs of <code>hello_world</code> and <code>hello_world_number</code> in a similar way?</p>