File tree Expand file tree Collapse file tree 1 file changed +37
-2
lines changed
Expand file tree Collapse file tree 1 file changed +37
-2
lines changed Original file line number Diff line number Diff line change 1- # mrmat-python-api-flask
2- Boilerplat code for a Python Flask API
1+ # MrMat :: Python :: API :: Flask
2+
3+ Boilerplate code for a Python Flask API
4+
5+ [ ![ Build] ( https://github.com/MrMatOrg/mrmat-python-api-flask/actions/workflows/build.yml/badge.svg )] ( https://github.com/MrMatOrg/mrmat-python-api-flask/actions/workflows/build.yml )
6+ [ ![ SAST] ( https://github.com/MrMatOrg/mrmat-python-api-flask/actions/workflows/sast.yml/badge.svg )] ( https://github.com/MrMatOrg/mrmat-python-api-flask/actions/workflows/sast.yml )
7+
8+
9+ This variant of a Python Flask API is code-first and using native Flask
10+
11+ Features:
12+
13+ * Code-first
14+ * Multiple API versions
15+ * No TLS, because this is intended to run behind a reverse proxy
16+ * Healthz
17+
18+ ## How to run this
19+
20+ Start with ` mrmat-python-api-flask ` . You can specify ` --host 0.0.0.0 ` to listen on a specific API and ` --port PORT ` to
21+ override the default 8080.
22+
23+ Once started, you can do curl towards the greeting API at ` /api/greeting/v1/ ` and ` /api/greeting/v1/?name=Custom ` .
24+ Note that omitting the last slash will cause a redirect that you can follow using curls -L option. We can probably
25+ get rid of that by using a more clever versioning scheme that doesn't make the root resource listen on / (e.g. ` /greeting ` ).
26+
27+ ## How to test this
28+
29+ Pycharm built-in. If you do it on the CLI, you do need ` python -m pytest ` , otherwise it'll get confused about loading
30+ its modules. Also note that the API spec yaml must be added once more when testing in ` conftest.py ` . The obvious attempt
31+ to have that done straight within ` mrmat_python_api_flask/app.py ` outside main doesn't work (and I don't know why).
32+
33+ ## How to build this
34+
35+ See the provided Dockerfile in ` var/docker ` . This requires that you have run ` python ./setup.py sdist ` as a prerequisite
36+ and will create a container image in which the application is run within a production-ready WSGI server.
37+
You can’t perform that action at this time.
0 commit comments