Mercurial > code > home > repos > patchablegraph
diff README.md @ 31:8d908762fe1e
rewrite for starlette
author | drewp@bigasterisk.com |
---|---|
date | Sun, 24 Apr 2022 00:47:41 -0700 |
parents | c3f0a692c4cb |
children |
line wrap: on
line diff
--- a/README.md Sun Apr 24 00:37:50 2022 -0700 +++ b/README.md Sun Apr 24 00:47:41 2022 -0700 @@ -15,15 +15,21 @@ [higher-level functions](https://bigasterisk.com/darcs/?r=rdfdb;a=headblob;f=/rdfdb/grapheditapi.py) from there, such as patchObject. -Web serving: +Web serving with starlette: -``` from patchablegraph import CycloneGraphHandler, -CycloneGraphEventsHandler +``` +from patchablegraph.handler import StaticGraph, GraphEvents + +masterGraph = PatchableGraph() -reactor.listenTCP(9059, cyclone.web.Application([ - ... - (r"/graph", CycloneGraphHandler, {'masterGraph': masterGraph}), - (r"/graph/events", CycloneGraphEventsHandler, {'masterGraph': masterGraph}), - ... +app = Starlette( + routes=[ + Route('/graph/environment', StaticGraph(masterGraph)), + Route('/graph/environment/events', GraphEvents(masterGraph)), + ... + ]) + ``` +* Versions 0.x.x used cyclone web and twisted. +* Versions 1.x.x use starlette and asyncio.