Skip to content

decorators support #2

@ruckc

Description

@ruckc

It would be nice if this style was supported to make it more sanic like. Essentially use decorators to add the checks, just like decorators add routes to the app.

app=Sanic("app")
hc = HealthCheck(app)


@app.get("/")
async def index(request):
    return text("Hello world")

@hc.check()
async def check_db():
    result = await db.ping()
    return True, "connected" if result else False, "disconnected"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions