GET handler

[sdks/expressjs/utils/GET handler]

Receives GET requests on the specified route and dispatches the corresponding response. Example:

  1. "my-express-server"@0 received on app ID

  2. "/status/"@0 received on route

  3. a client GET request received by express with URL ""

  4. the following signals are sent to other node(s) processing the request

  • { "accept": "application/json" }@0 sent on headers

  • { "q": "1", "p": "2" }@0 sent query

  1. The following signals are received back from processing nodes and sent out to the client:

  • 200@0 on status,

  • { "content-type": "application/json" }@0 on headers,

  • { status: "OK" }@0 on body

  1. null@0 sent on done

Keywords: api, request, response

Input ports

  • app ID: string

    The id of the express instance. Example: "my-express-server"

  • route: (string or string[])

    Receives the route(s) to handle requests for. Route be specified as exact match (1) or as pattern match (2). Example:

    1. "/status" will just match "/status"

    2. "/s*s" will match "status", "shoes", etc..

  • status: number

    Receives the HTTP status code to be sent with the response to the client. Example: 200

  • headers: {string: string}

    Receives the HTTP headers to be sent with the response to the client. Example: { "content-type": "application/json" }

  • body: any

    Receives the content to send to the client as response body. Example:

    • "OK"

    • 3.14

    • { "status": "OK" }

Output ports

  • headers: {string: string}

    Forwards the headers of the request to be processed. Example: { "content-type": "application/json" }

  • query: {string: any}

    Forwards the query parameters to process.

  • done: null

    Event triggered when the request has been processed.

Last updated