Skip to content

Instantly share code, notes, and snippets.

@aib
Forked from doobeh/aib.py
Last active November 30, 2016 16:38
Show Gist options
  • Save aib/b139faa6f95b37c15475569e7f34d99b to your computer and use it in GitHub Desktop.
Save aib/b139faa6f95b37c15475569e7f34d99b to your computer and use it in GitHub Desktop.
add_url_rule
from flask import Flask, request, jsonify
app = Flask(__name__)
app.secret_key = 'aib'
def homer():
def home():
return 'Ok'
return home
app.add_url_rule('/', 'something', homer())
app.add_url_rule('/other', 'something', homer())
if __name__ == '__main__':
with app.test_client() as c:
print(c.get('/').data)
print(c.get('/other').data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment