arboricxServer.tri (1191B)
1 !import io * 2 !import arboricx_server as Registry 3 !export main 4 5 -- Arboricx HTTP registry server. 6 -- Build/deploy: nix build .#arboricxServer (see docs/build-and-run.md). 7 -- The runner grants reads/writes only to ./store; dependencies are compiled 8 -- from their declared locations in the repository tricu.workspace. 9 -- 10 -- Endpoints: 11 -- GET / -> HTML landing page 12 -- GET /_arboricx/health -> "OK" 13 -- POST /_arboricx/bundle -> upload bundle, returns hash 14 -- GET /_arboricx/bundle/hash/:h -> download bundle by hash 15 -- GET /_arboricx/package/:n/:v -> administratively published release 16 -- 17 -- Example usage: 18 -- curl http://localhost:8080/ 19 -- curl http://localhost:8080/_arboricx/health 20 -- curl -X POST --data-binary @mybundle.arboricx http://localhost:8080/_arboricx/bundle 21 -- curl http://localhost:8080/_arboricx/bundle/hash/<hash> 22 23 -- Initialization and bind/listen failures must terminate the process, not leave 24 -- a deployment looking healthy after silently returning an error Result. 25 main = io (onResult_ 26 (do onOk_ 27 Registry.ensureStore "./store" 28 Registry.arboricxServer "./store" "0.0.0.0" 8080) 29 abortIO 30 pure)