Skip to content

Instantly share code, notes, and snippets.

@alanhoff
Created June 25, 2014 16:08
Show Gist options
  • Select an option

  • Save alanhoff/54764741bfc5302bd85b to your computer and use it in GitHub Desktop.

Select an option

Save alanhoff/54764741bfc5302bd85b to your computer and use it in GitHub Desktop.
Banco de dados (collections)
users
{
_id : uc934uc93ug9fh3409f8
password : iuyg389274gf973g9f7
feeds : [
{
url : 'http://feedlocodedoido.com.br/feed.rss',
},
{
url : 'http://feedlocodedoido.com.br/feed.atom',
},
{
url : 'http://feedlocodedoido.com.br/feed.xml',
}
]
}
feeds
user_id : uc934uc93ug9fh3409f8
title: String,
author: String,
link: String,
content: String,
published: {
type: Date,
default: Date.now
},
feed: {
name: String,
source: String,
link: String,
},
updater.js
(loop function(){
var User = mongoo.model('user');
User.find({}).exec(function(err, users){
if(err)
throw err;
(userLoop function(){
if(!users.length)
return setTimeout(loop, 1500000);
var user = users.shift();
pegar of feeds registrados em user.feeds e chamar o userLoop();
})()
});
})();
/api/v1/feeds.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment