1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
| from flask import Flask
| from flask_expects_json import expects_json
| app = Flask(__name__)
|
| schema = {
| 'type': 'object',
| 'properties': {
| 'name': {'type': 'string'},
| 'email': {'type': 'string'},
| },
| 'required': ['name', 'email']
| }
|
|
| @app.route('/', methods=['POST'])
| @expects_json(schema)
| def hello_world():
| return 'Hello, World!'
|
|