Documentation
code/hello-world/ $ tomodachi run service/app.py

Running a service

CLI alias is set up automatically on installation

# generic execution of services
app/ $ tomodachi run <path to .py file with service class code>

# example: if our service class exists in service/app.py
app/ $ tomodachi run service/app.py

Defaults to output information on stdout.

app/ $ tomodachi run service/app.py
>
> ---
> Starting tomodachi services (pid: 1) ...
> * service.py
>
> Current version: tomodachi x.x.xx on Python 3.x.x
> Event loop implementation: asyncio
> Local time: October 16, 2022 - 13:38:01,201509 UTC
> Timestamp in UTC: 2022-10-16T13:38:01.201509Z
>
> File watcher is active - code changes will automatically restart services
> Quit running services with <ctrl+c>
>
> 2022-10-16 13:38:01,234 (service): Initializing service "example" [id: <uuid>]
> 2022-10-16 13:38:01,248 (http): Listening [http] on http://127.0.0.1:9700/
> 2022-10-16 13:38:01,248 (service): Started service "example" [id: <uuid>]

HTTP services acts like a normal web server.

~/ $ curl -v "http://127.0.0.1:9700/resource/1234"
> HTTP/1.1 200 OK
> Content-Type: text/plain; charset=utf-8
> Server: tomodachi
> Content-Length: 9
> Date: Sun, 16 Oct 2022 13:38:02 GMT
>
> id = 1234