title: how to use parameters in add_url_rule flask
body: <p>I am trying to create a script to basically create all the flask endpoint from existing python classes/methods.</p>
  <p>one way which i came across was app.add_url_rule</p>
  <p>but it is not working for me</p>
  <pre class="lang-py prettyprint-override"><code>@app.route('/username/&lt;username&gt;')
  def userstatus(username):
      print(&quot;user is logged in&quot;)
  app.add_url_rule('/username/', 'userstatus', defaults={&quot;username&quot;:None})**
  </code></pre>
  <p>the above one is working but if i remove <code>@app.route('/username/&lt;username&gt;')</code> and try juust with <code>add_url_rule</code>, it is not working.</p>