Express

[sdks/expressjs/Express]


Core interface to Express.js. Use higher level nodes to interact with Express.


Keywords: http server, api, express, rest

Input ports

  • action:

    {"id": string, "type": string, "options": {string: any}}

    Receives the parameters of the action to execute. Example: { "id": "my-express-server", "type": "listen", "options": { "port": 3000 } }

  • response:

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

    Receives the response to be sent out to the client. Example: { "status": 200, "headers": { "content-type": "application/json" }, "body": "Done" }

Output ports

  • 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
    }

    Sends the request processed by defined handlers. Can be used to post-process the request.

  • done: (null or {"port": number, "hostname": string})

    Event triggered when the specified action has been executed.

  • error: {"error": string, "origin": string}

    Sends error information in case the specified action could not be successfully executed. Example: { "error": "listen EADDRINUSE: address already in use 127.0.0.1:8080", "origin": "server" }

Dependencies

(by compilation target and repository)

  • es6-node:

    • npm:

      • express

      • cors

Last updated