Protected static files?


I have a .html file that is generated by my frontend bundler which contains cache-busting files. This .html file basically serves as an entry point to an SPA.
In Sanic I use decorators to protect some of the REST API, and I would like to still have Sanic take care of the redirect to login page if a user is not logged in, or granting access. Basically I was trying to do this:

bp.static('/protected', './static/protected_file.html')

Any ideas on how to achieve this or something similar?

Thank you!

Edit: Ok I solved it, I should have RTFM more carefully. :slight_smile:

async def protected(request):
    return await response.file('./static/protected_file.html')