endpoints

You can add arbitrary GET endpoints with the endpoints namespace on any Part.

An endpoint can return an HttpResponse directly, or a Part (which is rendered for you); everything else we try to dump to json for you.

Example:

page = Page(
    parts__h1=html.h1('Hi!'),
    endpoints__echo__func=lambda value, **_: value,
)

This page will respond to ?/echo=foo by returning a json response "foo".