Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

decorators support #2

Open
ruckc opened this issue Feb 23, 2024 · 0 comments
Open

decorators support #2

ruckc opened this issue Feb 23, 2024 · 0 comments

Comments

@ruckc
Copy link

ruckc commented Feb 23, 2024

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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant