arboricxServer.tri (830B)
1 !import "io" !Local 2 !import "arboricx.server" !Local 3 4 -- Arboricx HTTP registry server. 5 -- Run with --allow-write ./store --allow-read ./store 6 -- 7 -- Endpoints: 8 -- GET / -> HTML landing page 9 -- GET /_arboricx/health -> "OK" 10 -- POST /_arboricx/bundle -> upload bundle, returns hash 11 -- GET /_arboricx/bundle/hash/:h -> download bundle by hash 12 -- 13 -- Example usage: 14 -- curl http://localhost:8080/ 15 -- curl http://localhost:8080/_arboricx/health 16 -- curl -X POST --data-binary @mybundle.arboricx http://localhost:8080/_arboricx/bundle 17 -- curl http://localhost:8080/_arboricx/bundle/hash/<hash> 18 19 main = io (thenIO 20 (putStrLn "Starting Arboricx server on 0.0.0.0:8080") 21 (thenIO 22 (void (ensureStore "./store")) 23 (arboricxServer "./store" "0.0.0.0" 8080)))