overleaf/services/web/app/coffee/Features/TrackChanges/TrackChangesController.coffee

13 lines
479 B
CoffeeScript
Raw Normal View History

2014-03-05 11:31:52 -05:00
logger = require "logger-sharelatex"
request = require "request"
settings = require "settings-sharelatex"
module.exports = TrackChangesController =
proxyToTrackChangesApi: (req, res, next = (error) ->) ->
url = settings.apis.trackchanges.url + req.url
logger.log url: url, "proxying to track-changes api"
2014-03-11 08:13:46 -04:00
getReq = request(url: url, method: req.method)
2014-03-05 11:31:52 -05:00
getReq.pipe(res)
getReq.on "error", (error) ->
logger.error err: error, "track-changes API error"
next(error)