Last active
October 21, 2021 13:12
-
-
Save haraonline/ee3e89d294438dbad97a3b80882a82ad to your computer and use it in GitHub Desktop.
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
# code for the lesson "understanding query strings" | |
# section 2: lecture 9 | |
from flask import Flask, render_template, request | |
app = Flask(__name__) | |
@app.route('/index') | |
@app.route('/') | |
def hello_flask(): | |
return 'Hello Flask' | |
@app.route('/new/') | |
def query_string(greeting='hello'): | |
query_val = request.args.get('greeting', greeting) | |
return '<h1> the greeting is: {0} </h1>'.format(query_val) | |
@app.route('/user') | |
@app.route('/user/<name>') | |
def no_query_strings(name='mina'): | |
return '<h1> hello there ! {} </h1>'.format(name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment