Socket
Socket
Sign inDemoInstall

@apihero/node

Package Overview
Dependencies
5
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @apihero/node

## Installation


Version published
Maintainers
2
Install size
266 kB
Created

Readme

Source

@apihero/node

Installation

npm install @apihero/node

Usage

Automatically proxy all 3rd-party requests through API Hero in Node.js

import { setupProxy } from "@apihero/node";

const proxy = setupProxy({
  projectKey: "hero_123abc",
  url: "https://proxy.apihero.run",
});

// Start intercepting requests and sending them to https://proxy.apihero.run
proxy.start();

// You can always stop intercepting requests
proxy.stop();

You can also setup matchers for only capturing some traffic:

import { setupProxy } from "@apihero/node";

const proxy = setupProxy({
  allow: [
    "https://api.github.com/*",
    "https://api.twitter.com/users/*",
    { url: "https://httpbin.org/*", method: "GET" },
  ],
  projectKey: "hero_123abc",
  url: "https://proxy.apihero.run",
});

// Start intercepting requests and sending them to https://proxy.apihero.run
proxy.start();

Capture all traffic except the matchers in the deny option:

import { setupProxy } from "@apihero/node";

const proxy = setupProxy({
  deny: ["https://myprivateapi.dev/*"]
  projectKey: "hero_123abc",
  url: "https://proxy.apihero.run",
});

// Start intercepting requests and sending them to https://proxy.apihero.run
proxy.start();

FAQs

Last updated on 22 Nov 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc