supports plugin creation from json sources
Zwiterrion opened this issue · comments
Etienne ANNE commented
Etienne ANNE commented
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