execjs Documentation

Documentation

GET /

This documentation.

Execute Code

POST /code

Required body-parameter:

code

Should be a base64 encoded string.

Example response:

{
    "data": "aGVqCg=="
}

Code example:

                    var data = {
    code: btoa('console.log("hej");')
};

fetch("https://execjs.emilfolino.se/code", {
    body: JSON.stringify(data),
    headers: {
        'content-type': 'application/json'
    },
    method: 'POST'
})
.then(function (response) {
    return response.json();
})
.then(function(result) {
    let decodedOutput = atob(result.data);
    console.log(decodedOutput); // outputs: hej
});