MAIF / wasmo

A WASM Binary builder for writing your Wasm plugins

Home Page:https://maif.github.io/wasmo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

supports plugin creation from json sources

Zwiterrion opened this issue · comments

curl -X POST http://localhost:5001/api/plugins -H 'Content-Type: application/json' -H 'Authorization: Basic aWQ6c2VjcmV0' --data-binary @- << EOF
{
  "metadata": {
    "type": "js",
    "name": "foo"
  },
  "files": [
    {
      "name": "index.js",
      "content": "export function execute() {    let context = JSON.parse(Host.inputString());        if (context.request.headers[\"foo\"] === \"bar\") {          const out = {              result: true          };          Host.outputString(JSON.stringify(out));      } else {          const error = {              result: false,              error: {                  message: \"you're not authorized\",                  status: 401              }          };          Host.outputString(JSON.stringify(error));      }        return 0;  }"
    }
  ]
}
EOF