Last active
February 22, 2018 10:39
-
-
Save jezeniel/fb5384effef044bcdfe64874a486f907 to your computer and use it in GitHub Desktop.
Workshop
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, jsonify, request, render_template | |
app = Flask(__name__) | |
@app.route('/page/<name>/') | |
def page(name): | |
return render_template('hello.html', name=name) | |
@app.route('/api/get/') | |
def index(): | |
return jsonify({'hello': 'world'}) | |
@app.route('/api/post/', methods=['POST']) | |
def api(): | |
data = request.get_json() | |
return jsonify(request_body=data) |
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
<html> | |
<body> | |
<h1>Hello, {{name}}</h1> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment