-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathfeed.js
More file actions
23 lines (22 loc) · 698 Bytes
/
Copy pathfeed.js
File metadata and controls
23 lines (22 loc) · 698 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
module.exports = function(app, talks, rss) {
app.get("/feed.xml", function(req, res, next) {
var feed = new rss({
title: "Aula.io feed",
description: "The best of tech talks in one place",
feed_url: "http://www.aula.io/feed.xml",
site_url: "http://www.aula.io"
});
talks.find({}).sort({ "added": -1 }).exec(function (err, docs) {
for(var i = 0; i < docs.length && i < 20; i++) {
feed.item({
title: docs[i].title,
url: docs[i].url,
description: docs[i].description,
date: docs[i].added
});
}
res.set("Content-Type", "text/xml");
res.send(feed.xml({indent: true}));
});
});
}