make start
-
object definition, validation, serialization/deserialization see https://github.com/ihiji/falcon-marshmallow
-
add swagger resource
# schema
class HealthSchema(Schema):
status: fields.Str = fields.Str(required=True)
message: fields.Str = fields.Str(required=True)
class HealthCheck:
# Handles GET requests
def on_get(self, req, resp):
"""Internal description not shown in swagger docs.
---
summary: Check application health
responses:
200:
description: status response
schema: HealthSchema
"""
resp.status = falcon.HTTP_200
resp.body = json.dumps({"status": resp.status, "message": "healthy"})
in swagger/init.py
self.spec.components.schema('Health', schema=injector.get(HealthSchema))
self.spec.path(resource=injector.get(HealthCheck))
Example: https://github.com/0mars/monoskel/pull/9/files
Swagger UI:
http://localhost:8021/v1/docs
must run the following to install dependencies before running the application, should be part of the container entrypoint, see packages/meerkat/.docker/entrypoint.sh, and meerkat/Makefile
make bootstrap
-- restart meerkat container
make restart meerkat
-- rebuild meerkat container
make clean-restart meerkat
-- remove all containers
make clean
Note: please read Makefile for more commands, also Makefile under meerkat/
PyMedPhys for monomanage, monorepository manager