Hi, I have a site that was previously written with tornado and am porting to sanic (sanic is much faster in my testing ) but having problems with the router.
I have one handler that attempts to load a page from the database based on the slug and a few other hard coded routes like so:
app.add_route(uri=r"/contact/", handler=contact_view, name="contact")
app.add_route(uri=r"/<slug:path>", handler=page_view, name="page")
Since the page_view
route matches the "/contact/"
url these routes are overlapping. With tornado it would just take the first rule matched but with sanic I cannot figure out what it is doing. It seems to work with some routes I have but not others.
I can manually re-route stuff in the page_view handler, but is there a better way to do it without putting the page_view under another path? Like a parameter to sort routes or prioritize one over another in this case?