1.5.0 • Published 6 years ago

express-noginx v1.5.0

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

noginx

a http/https proxy for nodejs

Feature

  1. http/https proxy
  2. middleware use express

Demo

const noginx = require("express-noginx");
const app = noginx.express();

app.use(function(req, res, next) {
    if (req.headers["host"] == "www.baidu.com") {
        res.writeHead(200, { "content-type": "text/html;charset=utf8" });
        res.write("哈哈!百度变成我的啦!!!");
        res.end();
    } else {
        next();
    }
});

app.listen(9999);

add the cert cert/ca.crt to rootCertificate and trust it npm.io

proxy setting (such as SwitchyOmega) npm.io

visit https://www.baidu.com npm.io