is it possible to create catch-all url similar to flask with sanic?
from flask import Flask
app = Flask(__name__)
@app.route('/', defaults={'path': ''})
@app.route('/<path:path>')
def catch_all(path):
return 'You want path: %s' % path
if __name__ == '__main__':
app.run()
I was able to create catch-all url with sanic
from sanic import Sanic, request
from sanic.response import text
app = Sanic(__name__)
@app.route('/')
@app.route('/<path:path>')
async def catch_all(request, path=''):
return text('You want path: %s' % path)
if __name__ == '__main__':
app.run()
Most helpful comment
I was able to create catch-all url with sanic