Add Facebook Open Graph

This commit is contained in:
Jonathan Cremin 2014-12-06 14:42:01 +00:00
parent 90c59078c0
commit 01c7f418dc
2 changed files with 17 additions and 6 deletions

View file

@ -26,7 +26,12 @@ module.exports = function(req, res, next) {
req.db.matches.findOne({_id:serviceId + itemId}).then(function(doc) {
if (doc) {
res.render(type, {page: type, title: doc.items[0].name + " by " + doc.items[0].artist.name, item: doc.items[0], items: doc.items});
res.render(type, {
page: type,
title: doc.items[0].name + " by " + doc.items[0].artist.name,
items: doc.items,
thisUrl: req.protocol + '://' + req.get('host') + req.originalUrl
});
} else {
Q.timeout(services[serviceId].lookupId(itemId, type), 5000).then(function(item) {
for (var id in services) {
@ -54,7 +59,12 @@ module.exports = function(req, res, next) {
items.unshift(item);
req.db.matches.save({_id:serviceId + itemId, items:items});
res.render(type, {page: type, title: item.name + " by " + item.artist.name, item: item, items: items});
res.render(type, {
page: type,
title: item.name + " by " + item.artist.name,
items: items,
thisUrl: req.protocol + '://' + req.get('host') + req.originalUrl
});
});
}, function(error) {
if (error.code == "ETIMEDOUT") {