Skip to main content

Module serve

Module serve 

Source
Expand description

yog serve — the CLI as a service for tools (Yog-IDLE): one JSON request per line on stdin, one reply per line on stdout. Every format is read, written and converted here, so a tool needn’t be rebuilt when a format changes — only this binary.

→ {"id": 1, "method": "yres.parse", "params": {"text": "{…}"}}
← {"id": 1, "result": {"entries": […]}}
← {"id": 2, "error": "…"}

Methods: see dispatch and the designers’ (design::service).

Functions§

dispatch
What a method does with its params; an error is a string, or {message, line} for a file that doesn’t parse.
run
Serves requests until stdin ends.