Last active
December 26, 2015 23:29
-
-
Save Fintan/7230491 to your computer and use it in GitHub Desktop.
proxy server using node, express and restler
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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