1import flask
2app = flask.Flask('your_flask_env')
3
4@app.route('/register', methods=['GET', 'POST'])
5def register():
6 if flask.request.method == 'POST':
7 username = flask.request.values.get('user') # Your form's
8 password = flask.request.values.get('pass') # input names
9 your_register_routine(username, password)
10 else:
11 # You probably don't have args at this route with GET
12 # method, but if you do, you can access them like so:
13 yourarg = flask.request.args.get('argname')
14 your_register_template_rendering(yourarg)
15
1from flask import Flask, request, jsonify
2
3app = Flask(__name__)
4
5@app.route('/foo', methods=['POST'])
6def foo():
7 data = request.json
8 return jsonify(data)