Skip to content

Instantly share code, notes, and snippets.

@haraonline
Last active October 21, 2021 13:12
Show Gist options
  • Save haraonline/ee3e89d294438dbad97a3b80882a82ad to your computer and use it in GitHub Desktop.
Save haraonline/ee3e89d294438dbad97a3b80882a82ad to your computer and use it in GitHub Desktop.
# 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