Send JavaScript code alongside with data and retrieve JSON output.
1{
2 "via": "json",
3 "data": {
4 "hello": "world"
5 },
6 "code": "
7 const { quotes } = await import('https://deno.land/x/[email protected]/mod.ts');
8 input['quote'] = quotes[0];
9 "
10}
“data“
is available as input
variable in code.
input
is auto-returned and available in response.
Response
1{
2 "hello": "world",
3 "quote": "Act only according to that maxim whereby you can, at the same time, will that it should become a universal law. - Immanuel Kant"
4}
curl --request POST \
--url https://api.execage.com/run \
--header 'Content-Type: application/json' \
--data '{
"via": "json",
"data": {
"hello": "world"
},
"code": "const { quotes } = await import('\''https://deno.land/x/[email protected]/mod.ts'\'');input['\''quote'\''] = quotes[0];"
}'
Code is executed inside dockerized sandbox using the Deno runtime. Users have access to network only.
Execution timeouts after 5 seconds.
Untrusted code can access internet.
Code is executed inside a Docker container.
JavaScript is executed using Deno runtime with access to all packages via dynamic import.
Keep me updated about where is this going.