2014-02-12 05:23:40 -05:00
|
|
|
request = require 'request'
|
|
|
|
Settings = require 'settings-sharelatex'
|
|
|
|
logger = require 'logger-sharelatex'
|
|
|
|
|
|
|
|
module.exports = SpellingController =
|
|
|
|
proxyRequestToSpellingApi: (req, res, next) ->
|
|
|
|
url = req.url.slice("/spelling".length)
|
|
|
|
url = "/user/#{req.session.user._id}#{url}"
|
|
|
|
req.headers["Host"] = Settings.apis.spelling.host
|
|
|
|
getReq = request(url: Settings.apis.spelling.url + url, method: req.method, headers: req.headers, json: req.body)
|
|
|
|
getReq.pipe(res)
|
|
|
|
getReq.on "error", (error) ->
|
|
|
|
logger.error err: error, "Spelling API error"
|
2015-07-08 11:56:38 -04:00
|
|
|
res.sendStatus 500
|