/execute-js

This endpoint allows users to execute JavaScript code securely in a controlled environment. You can submit JavaScript code to be executed, and it will return the output or an error if the execution fails.

Endpoint Information

  • Method: POST
  • Endpoint URL: https://node.nodetrigger.com/api/execute-js
  • Content Type: application/json

Example Requests

To execute JavaScript code, send a POST request to the endpoint with the JSON payload as follows:

{
  "code": "console.log(1 + 1);"
}

Notes

  • Ensure that you provide the JavaScript code in the “code” field of the JSON payload.
  • If the “code” field is missing or empty, the server will respond with an error message: “No JavaScript code provided”.
  • The JavaScript code is executed in a secure environment, meaning external resources can only be accessed if specified.
  • If there is any error during the execution of the JavaScript code, the server will respond with an error message, along with details of the error.
  • This endpoint is designed to handle basic JavaScript execution securely, but there are inherent limitations on the complexity of the code that can be executed.

“`