Newts Parading Majestically

    http-proxy-lite
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.6 • Public • Published

    http-proxy-lite

    NPM Version Node Version

    a tiny http proxy of node.js

    Installation

    npm i http-proxy-lite -S

    Usage

    proxy server

    import * as http from 'http';
    import * as httpProxy from 'http-proxy-lite';
     
    const proxy = httpProxy.createProxyServer();
     
    http
      .createServer(function(req, res) {
        proxy.web(req, res, { target: 'http://127.0.0.1:3001' });
      })
      .listen(3000);

    endpoint server

    import * as http from 'http';
     
    http
      .createServer(function(req, res) {
        res.end('hello, response from 3001');
      })
      .listen(3001);

    then open http://localhost:3000/ with your browser, it will shows hello, response from 3001

    Todo

    • xxxx

    License

    MIT

    Install

    npm i http-proxy-lite

    DownloadsWeekly Downloads

    0

    Version

    1.0.6

    License

    MIT

    Unpacked Size

    10.2 kB

    Total Files

    5

    Last publish

    Collaborators

    • cooperhsiung