Update docs with Starlette 0.13+ usage
florimondmanca opened this issue · 0 comments
florimondmanca commented
Starlette 0.13 introduced a new declarative style for defining apps, routes, etc. (see
routes = [
Route('/', homepage),
Mount('/users', routes=[
Route('/', users, methods=['GET', 'POST']),
Route('/{username}', user),
])
]
app = Starlette(routes=routes)
Our documentation is now out of date w.r.t. https://www.starlette.io. So although things aren't broken, we need to update the code snippets to use the declarative style for consistency with the newest Starlette release.
A note on per-endpoint caching docs: we should keep the @cached()
decorator on top of HTTPEndpoint
instances, even though #23 makes me think we should probably rejig the @cached()
decorator into something that can perform both as a decorator and a standard function (e.g. cache_endpoint(home, cache=cache)
).