-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
24 lines (20 loc) · 858 Bytes
/
app.py
File metadata and controls
24 lines (20 loc) · 858 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
"""
THE MAIN APP
- Loads a yaml file describing the API in swagger/OpenAPI 2.0
- Links endpoints to functions in modules with the "operationId" declaration in the yaml
- Serves:
- The endpoints on their declared path: e.g. http://0.0.0.0:8888/api/v1/travel-intents/
- The Interactive Swagger UI: http://0.0.0.0:8888/api/v1/ui/
- The raw swagger JSON: http://0.0.0.0:8888/api/v1/swagger.json
- Served by "gevent"
Run this main app with: `python app.py`
"""
import connexion
if __name__ == '__main__':
# Config app
app = connexion.App(__name__, specification_dir='openapi/', server='gevent')
# Add API yaml file
app.add_api('openapi.yaml', validate_responses=True)
# Run
print("RUN: http://0.0.0.0:8888/api/v1/ui/")
app.run(port=8888)