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:
@auth.login_required bp.static('/protected', './static/protected_file.html')
Any ideas on how to achieve this or something similar?
Edit: Ok I solved it, I should have RTFM more carefully.
@bp.route('/protected') @auth.login_required async def protected(request): return await response.file('./static/protected_file.html')