Skip to content

Commit

Permalink
Added atom.xml support
Browse files Browse the repository at this point in the history
  • Loading branch information
gastaldi committed May 22, 2015
1 parent 41ee01f commit 3f457d3
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"config-multipaas": "^0.1.0",
"restify": "^2.8.3",
"fetch" : "0.3.6",
"js-yaml": "3.3.0"
"js-yaml": "3.3.0",
"feed" : "0.2.6"
},
"devDependencies": {},
"bundleDependencies": [],
Expand Down
29 changes: 29 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ var cc = require('config-multipaas'),
fs = require('fs'),
url = require('url'),
yaml = require('js-yaml'),
Feed = require('feed'),
exec = require('child_process').exec;
// Git utilities
var Git =
Expand Down Expand Up @@ -148,6 +149,34 @@ app.post('/api/v2/webhooks/cache_invalidate', function(req, res) {
res.end();
});

app.get('/atom.xml', function (req,res) {
var feed = new Feed({
title: 'JBoss Forge Blog Feed',
description: 'Stay up to date on JBoss Forge',
link: 'http://forge.jboss.org/',
//image: 'http://forge.jboss.org/images/forge_logo_215x60.png',
copyright: 'Copyright 2015 Red Hat, Inc. and/or its affiliates',
author: {
name: 'JBoss Forge Team'
}
});
getNews().forEach(function (newsItem) {
feed.addItem({
title: newsItem.title,
link: 'http://forge.jboss.org/#/news/' + newsItem.id,
author: {
name: newsItem.author
},
description: newsItem.summary,
date: newsItem.date
});
});
res.status(200);
res.header("Content-Type", "text/xml");
res.write(feed.render('atom-1.0'));
res.end();
});

// Everything except the already defined routes. IMPORTANT: this should be the last route
app.get(/\/?.*/, restify.serveStatic({default: 'index.html', directory: './app/'}));

Expand Down

0 comments on commit 3f457d3

Please sign in to comment.