/RewstJS

Run Javascript natively in Rewst.

Primary LanguageJavaScriptMIT LicenseMIT

Overview

Use this project and workflow to run raw JavaScript directly in Azure Functions. This is similar to my RewstPS project.

Setup

  1. Fork this repository.

  2. Create a Function App in Azure. You'll want to use NodeJS 18 LTS or 20 and Linux as your operating system..

  3. In your Function App in Azure, go to Deployment Center and connect it to the forked GitHub repository.

  4. In Overview, copy your URL. We'll use this later to setup our Custom Integration. It will look like the following: https://yourfunctionapp.azurewebsites.net/api/run.

  5. Navigate to your function app in Azure, then go to Overview. Under functions, click ScriptRunner.

  6. Under Function Keys, copy your default key. We'll also be using this in the Custom Integration.

  7. In Rewst, navigate to Configuration > Integrations > Custom Integrations. Add a new one called "Rewst JavaScript" and match the settings below:

    Hostname API Key Authentication Method API Key Header Name
    yourfunctionapp.azurewebsites.net The key you copied API Key x-functions-key
  8. Import the run-javascript.bundle.json file as a new workflow.

  9. In the run_script action under Advanced, you may need to add an Integration Override for your new Rewst JavaScript integration as well and then click publish.

Usage

  1. Open the Run JavaScript workflow and click Test.
  2. For script content, enter return { "foo": "bar" }.
  3. See your result in RESULT.result.

Packages

If you wish to use any packages, you'll need to install them yourself in your forked project with npm.