/ student-intifada / node_modules / httpxy /

[ICO]NameLast modifiedSizeDescription
[PARENTDIR]Parent Directory  -  
[DIR]dist/a year ago -  
[   ]LICENSEa year ago2.2K 
[TXT]README.mda year ago2.0K595aea1 more query options + view options [كارل مبارك]
[   ]package.jsona year ago1.3Kafd0ccc remove unused [كارل مبارك]
README.md

🔀 httpxy

npm version npm downloads bundle Codecov

A Full-Featured HTTP and WebSocket Proxy for Node.js forked from http-party/node-http-proxy with modern Typescript rewrite.

Usage

Install package:

# npm
npm install httpxy

# yarn
yarn add httpxy

# pnpm
pnpm install httpxy

Create proxy:

import { createServer } from "node:http";

import { createProxyServer } from "httpxy";

const proxy = createProxyServer({});

const server = createServer(async (req, res) => {
  try {
    await httpProxy.web(req, res, {
      target: main.url,
    });
  } catch (error) {
    console.error(error);
    res.statusCode = 500;
    res.end("Proxy error: " + error.toString());
  }
});

server.listen(3000, () => {
  console.log("Proxy is listening on http://localhost:3000");
});

Checkout http-party/node-http-proxy for more options and examples.

Development

License

Made with 💛

Published under MIT License.

Apache/2.4.38 (Debian) Server at www.karls.computer Port 80