wrapped up rss for topics. added a new route to access these feeds from the url topic/tid.rss

This commit is contained in:
psychobunny
2013-05-30 16:02:13 -04:00
parent 9a15177d50
commit 4b17f1d4e6
2 changed files with 28 additions and 9 deletions

View File

@@ -94,8 +94,21 @@ var express = require('express'),
// Complex Routes
app.get('/topic/:topic_id/:slug?', function(req, res) {
var topic_url = req.params.topic_id + (req.params.slug ? '/' + req.params.slug : '');
topics.get_cid_by_tid(req.params.topic_id, function(cid) {
var tid = req.params.topic_id;
if (tid.match('.rss')) {
fs.readFile('feeds/topics/' + tid, function (err, data) {
if (err) {
res.send("Unable to locate an rss feed at this location.");
return;
}
res.send(data);
});
return;
}
var topic_url = tid + (req.params.slug ? '/' + req.params.slug : '');
topics.get_cid_by_tid(tid, function(cid) {
res.send(
build_header() +
'<script>templates.ready(function(){ajaxify.go("topic/' + topic_url + '");});</script>' +