examples/archived/curl_template
2022-08-01 10:08:26 +03:00
..
backend update marine and marine-rs-sdk in all the crates (#373) 2022-08-01 10:08:26 +03:00
frontend Reorg (#10) 2021-07-16 02:04:18 -05:00
.gitignore Reorg (#10) 2021-07-16 02:04:18 -05:00
deploy.sh Reorg (#10) 2021-07-16 02:04:18 -05:00
README.md Reorg (#10) 2021-07-16 02:04:18 -05:00
repl_config.toml Reorg (#10) 2021-07-16 02:04:18 -05:00
request.air Reorg (#10) 2021-07-16 02:04:18 -05:00
script.air Reorg (#10) 2021-07-16 02:04:18 -05:00

Download & return URL via curl

An example to kick-off building services on Fluence.

What it does:

  • exploits mounted_binaries to call /usr/bin/curl on the host OS
  • downloads any url, and returns its content as a resulting String

BackendConfig.json

Wasm module is configured with this simple JSON config:

{
  // import name of the module; needed when linking modules in multi-module setups
  "name": "curl_adapter",
  // binaries available to call
  "mountedBinaries":
    {
      // curl will be callable as a host function
      "curl": "/usr/bin/curl"
    }
}

P.S. JSON5 has comments! yaaay!

Build & deploy it

./deploy.sh

Call it

fldist run_air -p request.air -d '{"service": "19e70712-04b6-496e-96d9-9eab87bef9c6"}'

Run frontend

cd frontend
npm i
npm start