This commit is contained in:
Henry Oswald 2014-07-09 19:49:39 +01:00
parent c5497a6c07
commit 5cf756969e
3 changed files with 23 additions and 0 deletions

View file

@ -0,0 +1,17 @@
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

View file

@ -36,6 +36,7 @@ DropboxUserController = require("./Features/Dropbox/DropboxUserController")
PasswordResetRouter = require("./Features/PasswordReset/PasswordResetRouter")
StaticPagesRouter = require("./Features/StaticPages/StaticPagesRouter")
ChatController = require("./Features/Chat/ChatController")
BlogController = require("./Features/Blog/BlogController")
logger = require("logger-sharelatex")
_ = require("underscore")
@ -64,6 +65,8 @@ module.exports = class Router
StaticPagesRouter.apply(app)
TemplatesRouter.apply(app)
app.get '/blog/*', BlogController.getPage
if Settings.enableSubscriptions
app.get '/user/bonus', AuthenticationController.requireLogin(), ReferalMiddleware.getUserReferalId, ReferalController.bonus

View file

@ -0,0 +1,3 @@
div #{title}
div #{author}
div !{content}