Skip to content

Instantly share code, notes, and snippets.

@SFoskitt
Last active March 13, 2017 19:09
Show Gist options
  • Save SFoskitt/d7b05dd1e1523499129f79f673af6950 to your computer and use it in GitHub Desktop.
Save SFoskitt/d7b05dd1e1523499129f79f673af6950 to your computer and use it in GitHub Desktop.
Node Budgeting
var router = require('express').Router(),
request = require('request'),
common = require(global.app_controllers + '/common');
/**
* Get budgeting info per PO or PR
* /purchaseapi/api/unitId/{unitId}/purchase-requests/{requestId}/budget-data/list
* purchaseapi/api/purchase-requests/576b8acee4b09e5955ba6cb2
*/
router.route('/budgeting/:id', function(req, res) {
request.get({
url: common.purchaseApiUrl + '/api/unitId/' + res.locals.unitId + '/purchase-requests/' + req.params.id + '/budget-data/list' ,
json: true
}, function(err, response, body) {
if (common.handleRequestException(res, response))
return;
res.json(body);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment