# http-node-proxy-plugin

> An http service proxy library

Latest version **1.0.1** (published 2023-01-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install http-node-proxy-plugin
pnpm add http-node-proxy-plugin
yarn add http-node-proxy-plugin
bun add http-node-proxy-plugin
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2023-01-07 |
| First published | 2023-01-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=12 |
| Dependencies | 0 |
| Unpacked size | 14.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | yxlazy |
| Maintainers | yanxiaolazy |
| Keywords | proxy-plugin, proxy, http, https |

## Links

- npm: https://www.npmjs.com/package/http-node-proxy-plugin
- Repository: https://github.com/yxlazy/http-node-proxy-plugin
- Homepage: https://github.com/yxlazy/http-node-proxy-plugin#readme
- Issues: https://github.com/yxlazy/http-node-proxy-plugin/issues
- npm.io page: https://npm.io/package/http-node-proxy-plugin

## Recent versions

- 1.0.1 (latest) — 2023-01-07
- 1.0.0 — 2023-01-07

## README

## http-node-proxy-plugin

> An http service proxy library

### Install

```bash
npm i http-node-proxy-plugin
```

or

```bash
yarn add http-node-proxy-plugin
```

or

```bash
pnpm i http-node-proxy-plugin
```
### Usage


```typescript
import proxyPlugin from "http-node-proxy-plugin"
import http form "http"

const proxy = proxyPlugin({
  target: `https://localhost/`,
  changeOrigin: true,
  rewrite(path: any) {
    return path.replace(/^\/proxyApi/, '')
  },
})

const server = http.createServer((req, res) => {
  if (req.url.indexOf('/proxyApi') === 0) {
    proxy(req.url, 'GET', undefined, { headers: req.headers }).then((data) => {
      res.writeHead(200);
      res.end(data);
    })
  }
  // ...
})

server.listen(8080)
```

---
_Source: https://npm.io/package/http-node-proxy-plugin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
