heavenbean / RnD

0 stars 0 forks source link

Nodejs request forwarder #1

Open heavenbean opened 3 years ago

heavenbean commented 3 years ago
var express = require('express');
var app = module.exports = express();

var proxy = require('http-proxy').createProxyServer({
    host: 'http://158.247.213.193:3001',
    // port: 80
});
app.use('/', function(req, res, next) {
    proxy.web(req, res, {
        target: 'http://158.247.213.193:3001'
    }, next);
});

app.listen(3001, function(){
    console.log('Listening!');
});