Created
August 9, 2022 02:31
-
-
Save nenodias/abd89ed5bb472d5492edb221b833e329 to your computer and use it in GitHub Desktop.
Flask app without using decorator with @
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask | |
app = Flask(__name__) | |
def hello(): | |
return "Hello world" | |
app.route("/", methods=['get'])(hello) | |
app.run() |
I like this syntax more than decorator based syntax
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://flask.palletsprojects.com/en/stable/api/#flask.Flask.add_url_rule