Express route creator

[scripting/actions/Express route creator]


Sets up an API endpoint using Express. An express server must be started in the script before the flow gets to this one. See scripting/actions/Express server starter.


Keywords: api, route, endpoint, request, response, setup, initialize, handle

Input ports

  • state: any

    Receives script state.

  • params:

    {
      "cwd": string,
      "result-path": string,
      "message": string,
      "method": ("GET" or "POST" or "PUT" or "PATCH" or "DELETE"),
      "route": string,
      "app-id": string
    }
  • response:

    {"status": number, "headers": {string: string}, "body": any}

Output ports

  • state: any

    Sends updated script state.

  • request:

    {
      "baseUrl": string,
      "body": any,
      "cookies": any,
      "hostname": string,
      "headers": {string: string},
      "ip": string,
      "ips": string[],
      "method": ("GET" or "POST" or "PUT" or "PATCH" or "DELETE"),
      "originalUrl": string,
      "params": {string: string},
      "path": string,
      "protocol": ("http" or "https"),
      "query": {string: any},
      "route": string,
      "secure": boolean,
      "signedCookies": any,
      "stale": boolean,
      "subdomains": string[],
      "xhr": boolean
    }

Last updated