mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-27 12:21:03 +00:00
14 lines
565 B
CoffeeScript
14 lines
565 B
CoffeeScript
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"
|
|
res.send 500
|