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