Skip to content

Instantly share code, notes, and snippets.

@Fintan
Last active December 26, 2015 23:29
Show Gist options
  • Save Fintan/7230491 to your computer and use it in GitHub Desktop.
Save Fintan/7230491 to your computer and use it in GitHub Desktop.
proxy server using node, express and restler
var express = require('express'),
app = express(),
restler = require('restler'),
path = require('path');
app.configure(function () {
app.use(express.logger('dev')); /* 'default', 'short', 'tiny', 'dev' */
app.use(express.static(path.join(__dirname, '../WWW/dist')));
app.use(express.bodyParser());
});
app.listen( 1234);
app.all('/*', function(req, res) {
var request = restler.get('https://fboyle.com/services' + req.url, {
}).once('complete', function (data) {
console.log(data)
res.json(data);
request.removeAllListeners('error');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment