@agaezcode Yes, Express makes it easy for you to do that. If you really want to share the entire uploads folder with everyone, then you can make it an express.static
directory in app.js, just like public directory. By default, if I remember all files are uploaded as random hashes without file extensions, so it's up to you to add file extension when you save a file to /uploads. And yes typically you would save a reference (unique filename) to your database and then upload this file to S3.
You can then get that file from S3 via URL:https://s3.amazonaws.com/YOUR_BUCKET_NAME/YOUR_FILENAME
index.js
. Sure it makes "require/import" really clean, but oh wow what a pain it was to switch between these files inside IDE when all files are named index.js.
@sahat @uptownhr
Hola Guys!
I'm looking for a solution to a problem I'm currently facing, any kind of help will be greatly appreciated.
I've an array of 35 Yahoo WOEIDs in woeids.trends_country_capital
, with which I want to fetch twitter trends for respective WOEIDS. Now twitter has a limit of 1 req/min for it's trends API, so I would like to fetch 35 WOEID's trends with 1 at a time and once all done will repeat the process indefinitely.
node module - cron
const worldWide = new CronJob({
cronTime: '0 */35 * * * *',
onTick: function() {
_(woeids.trends_country_capital).forEach(woeid => {
new CronJob('0 */1 * * * *', function() {
trendsCountry.get('/trends/place', {id: woeid}, function(error, trends, response) {
if (!error) {
dbCountries.countries.update(
{ woeid: woeid },
{
woeid: woeid,
trends: trends[0].trends,
lastUpdated: new Date().getTime()
},
{ upsert: true },
function (err, data) {
console.log(err, data);
}
)
}
});
}, null, true, 'America/Los_Angeles');
});
},
start: false,
timeZone: 'America/Los_Angeles'
});
async
for this http://stackoverflow.com/questions/15886096/infinite-execution-of-tasks-for-nodejs-application