-
Clone this gist and enter the directory.
-
Install Tiled and and, optionally, a HTTP client to test with.
pip install tiled[all] httpie
-
Start the server:
python plugin_route_example.py
-
Test the custom route:
http :8000/api/v1/example/
It should look like this:
$ http :8000/api/v1/example/
HTTP/1.1 200 OK
content-length: 17
content-type: application/json
date: Fri, 12 May 2023 19:39:02 GMT
server: uvicorn
server-timing: app;dur=3.7
set-cookie: tiled_csrf=lg1oMoZ52b5o3yqXL9JunT4RwNxhIy5dvHYEuQSQGV8; HttpOnly; Path=/; SameSite=lax
{
"hello": "world"
}
https://github.com/bluesky/tiled/blob/c88f41bed4b538aefbfde27d3659afb93809eb27/tiled/server/router.py#L350