tricu

An interpreted language for exploring Tree Calculus
Log | Files | Refs | README | LICENSE

cfca5387189b91a6fabf49445f722a86113a68db9f70b611b78e540004432fd0.tri (749B)


      1 !import prelude *
      2 !import io *
      3 !import arboricx_server *
      4 !export *
      5 
      6 -- Arboricx HTTP registry server demo.
      7 -- Run with --allow-write /tmp/store --allow-read /tmp/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/bundle
     17 --   curl http://localhost:9050/_arboricx/bundle/hash/<hash>
     18 
     19 main = io (do bind
     20   putStrLn "Starting Arboricx server on 127.0.0.1:9050"
     21   do onOk_
     22     ensureStore "/tmp/store"
     23     arboricxServer "/tmp/store" "127.0.0.1" 9050)