mirror of
https://github.com/kennethreitz/responder.git
synced 2026-06-05 14:50:19 +00:00
9d492a383c
- Document mounting marimo ASGI apps in the feature tour - Add examples/marimo_mount.py showing the integration - Verified working: marimo.create_asgi_app() mounts cleanly via api.mount() Fixes #580. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
32 lines
652 B
Python
32 lines
652 B
Python
"""Mount marimo notebooks inside a Responder API.
|
|
|
|
Requirements:
|
|
pip install responder marimo
|
|
|
|
Usage:
|
|
python examples/marimo_mount.py
|
|
|
|
Then visit:
|
|
http://127.0.0.1:5042/hello → Responder JSON endpoint
|
|
http://127.0.0.1:5042/notebooks/ → Interactive marimo notebook
|
|
"""
|
|
|
|
import marimo
|
|
|
|
import responder
|
|
|
|
api = responder.API()
|
|
|
|
|
|
@api.route("/hello")
|
|
def hello(req, resp):
|
|
resp.media = {"message": "Hello from Responder!"}
|
|
|
|
|
|
# Mount marimo notebooks at /notebooks
|
|
server = marimo.create_asgi_app().with_app(path="", root="notebooks/hello.py")
|
|
api.mount("/notebooks", server.build())
|
|
|
|
if __name__ == "__main__":
|
|
api.run()
|