Created
September 6, 2014 18:17
-
-
Save DGaffney/070069dc7f9f0d72afee to your computer and use it in GitHub Desktop.
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
| //api.js | |
| var request = require('request-json'); | |
| var base_url = "http://192.168.1.165:8080/v1/" | |
| var client = request.newClient(base_url); | |
| exports.request = function (url) { | |
| client.get(base_url+url, function (error, response, body) { | |
| return body | |
| }) | |
| }; | |
| //users.js | |
| var express = require('express'); | |
| var api = require('../modules/api'); | |
| var router = express.Router(); | |
| /* GET users listing. */ | |
| router.get('/', function(req, res) { | |
| res.send(api.request("user/index.json")); | |
| }); | |
| module.exports = router; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment