node.js - How to configure AppJS to work with node-http-proxy server -
i'm trying node-http-proxy working appjs. unfortanly crashes on launch of app. did:
- download & extracted appjs http://appjs.com/;
- installed node-http-proxy npm install http-proxy;
edited app.js window.on(create) function:
window.on('create', function(){ console.log("window created"); window.frame.show(); window.frame.center(); window.frame.setmenubar(menubar); var http = require('http'), httpproxy = require('http-proxy'); // // create proxy server , set target in options. // httpproxy.createproxyserver({target:'http://localhost:9000'}).listen(8000); // // create target server // http.createserver(function (req, res) { res.writehead(200, { 'content-type': 'text/plain' }); res.write('request proxied!' + '\n' + json.stringify(req.headers, true, 2)); res.end(); }).listen(9000); });
when app starts want start nodejs proxy server. possible connect external pc proxy server? (i know need open ports this)
for example if run app on home pc , @ work set proxy settings of work pc homepc_ip:8000. work?
haven't got fix crash of node-http-proxy instead used https://github.com/tootallnate/proxy , works charm!
Comments
Post a Comment