overleaf/services/web/app/coffee/Features/Blog/BlogController.coffee

18 lines
463 B
CoffeeScript
Raw Normal View History

2014-07-09 14:49:39 -04:00
request = require("request")
settings = require("settings-sharelatex")
logger = require("logger-sharelatex")
module.exports =
getPage: (req, res)->
url = req.url
logger.log url:url, "proxying request to blog api"
request.get "#{settings.apis.blog.url}#{url}", (err, r, data)->
console.log data
try
data = JSON.parse(data)
catch err
logger.err err:err, data:data, "error parsing data from data"
res.render "blog/#{data.layout}", data