mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Support non-async view functions, closes #867
This commit is contained in:
parent
1bb33dab49
commit
4b142862f2
4 changed files with 33 additions and 10 deletions
|
|
@ -514,7 +514,7 @@ register_routes()
|
|||
|
||||
Register additional view functions to execute for specified URL routes.
|
||||
|
||||
Return a list of ``(regex, async_view_function)`` pairs, something like this:
|
||||
Return a list of ``(regex, view_function)`` pairs, something like this:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
|
|
@ -554,6 +554,8 @@ The optional view function arguments are as follows:
|
|||
``receive`` - function
|
||||
The ASGI receive function.
|
||||
|
||||
The view function can be a regular function or an ``async def`` function, depending on if it needs to use any ``await`` APIs.
|
||||
|
||||
The function can either return a :ref:`internals_response` or it can return nothing and instead respond directly to the request using the ASGI ``send`` function (for advanced uses only).
|
||||
|
||||
Examples: `datasette-auth-github <https://github.com/simonw/datasette-auth-github>`__, `datasette-psutil <https://github.com/simonw/datasette-psutil>`__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue