Skip to main content

Node.js

Node.js is fully supported by Speedscale, but proxy behavior depends on the HTTP client library. Use this page for Node-specific proxy settings, TLS trust configuration, demo guidance, and the Proxymock local workflow.

Demo App

  • Public demo: speedscale/demo (node directory)
  • Stack: Express
  • Local run: npm install && npm start
  • Quick validation: curl http://localhost:3000/

This is the current public Node.js demo used for local Proxymock examples.

Proxymock

Use this path for the fastest Node.js first success on a developer workstation.

  1. 1. Install and initialize Proxymock
    brew install speedscale/tap/proxymock
    proxymock init

    Use browser sign-in by default. Use `proxymock init --api-key <your key>` only for CI or other headless environments.

  2. 2. Start recording
    git clone https://github.com/speedscale/demo
    cd demo/node
    proxymock record --app-port 3000 --out ./proxymock/recorded

    The app listens on port 3000 while proxymock records inbound traffic on 4143 and saves the capture in `./proxymock/recorded`.

  3. 3. Route traffic through the proxy and run the app
    cd demo/node
    export HTTP_PROXY=http://127.0.0.1:4140
    export HTTPS_PROXY=http://127.0.0.1:4140
    npm install
    npm start

    Many Node HTTP clients need explicit proxy support, so set the environment variables and client agent together when needed.

  4. 4. Generate one real workflow
    curl http://localhost:4143/
    curl http://localhost:4143/nasa
    curl http://localhost:4143/events
    curl http://localhost:4143/bin

    Exercise the demo endpoints once so the recording reflects the real outbound calls.

  5. 5. Stop the recording, then run with mocks
    cd demo/node
    proxymock mock --in ./proxymock/recorded
    export HTTP_PROXY=http://127.0.0.1:4140
    export HTTPS_PROXY=http://127.0.0.1:4140
    npm start

    The mocked run should no longer need live downstream access.

  6. 6. Replay the same traffic against a change
    cd demo/node
    proxymock replay --in ./proxymock/recorded --test-against http://localhost:3000

    Use replay as the regression check before shipping Node.js changes.

TLS Trust

Node.js usually respects NODE_EXTRA_CA_CERTS. For the exact command and client-specific caveats, use the shared Language Configuration page.