Basic Flask program : Just a start flask program
import os
import json
from flask import Flask
from flask import jsonify
app = Flask(__name__)
@app.route('/')
def hello():
return 'Hello World!'
@app.route('/foo')
def foo():
return 'bar'
@app.route('/hi/<name>')
def hi(name):
return f'Hi {name}!'
@app.route('/api')
def api():
data = {
'name': 'Andrew',
'user': 'acroz'
}
return jsonify(data)
if __name__ == '__main__':
app.run(debug=True)
import os
import json
from flask import Flask
from flask import jsonify
app = Flask(__name__)
@app.route('/')
def hello():
return 'Hello World!'
@app.route('/foo')
def foo():
return 'bar'
@app.route('/hi/<name>')
def hi(name):
return f'Hi {name}!'
@app.route('/api')
def api():
data = {
'name': 'Andrew',
'user': 'acroz'
}
return jsonify(data)
if __name__ == '__main__':
app.run(debug=True)
Comments