There's more...

Sometimes, we might want to have a URL map kind of a pattern, where we prefer to define all the URL rules with endpoints at a single place rather than them being scattered all around the application. For this, we will need to define our methods without the route() decorator and define the route on our application object, as shown here:

def get_request(): 
bar = request.args.get('foo', 'bar')
return 'A simple Flask request where foo is %s' % bar app = Flask(__name__) app.add_url_rule('/a-get-request', view_func=get_request)

Make sure that you give the correct relative path to the method assigned to view_func.