1
0
mirror of https://github.com/fluencelabs/examples synced 2024-12-04 19:20:17 +00:00
examples/curl_template
2021-02-25 15:54:44 -06:00
..
backend Add curl_template 2021-02-26 00:18:07 +03:00
frontend Add curl_template 2021-02-26 00:18:07 +03:00
.gitignore merge curl_template 2021-02-25 15:54:44 -06:00
air.clj Add curl_template 2021-02-26 00:18:07 +03:00
deploy.sh Add curl_template 2021-02-26 00:18:07 +03:00
README.md Add curl_template 2021-02-26 00:18:07 +03:00
repl_config.toml Add curl_template 2021-02-26 00:18:07 +03:00

Download & return URL via curl

An example repo 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 air.clj -d '{"service": "e90bfbaf-ede7-4fbe-b45a-6250bf36ed3e"}'

Run frontend

cd frontend
npm i
npm start