This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var async = require('async'); | |
async.series([ | |
function(callback) { | |
// some async task | |
callback(); | |
}, | |
function(callback) { | |
// some async task | |
callback(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var async = require('async'); | |
async.waterfall([ | |
function(callback) { | |
// some code to execute | |
// in case to go to next function provide callback like this. | |
callback(null,valueForNextFunction); | |
// Got some error ? Don't wanna go further. | |
// Provide true in callback and execution will stop. | |
//callback(true,"Some error"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var async = require('async'); | |
var emails = ["[email protected]","[email protected]"]; | |
async.each(emails,function(singleEmail,callback) { | |
// Emailer code | |
// singleEmail will be one value at a time. | |
},function(err,data) { | |
// Once all done, comes here. | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var async = require('async'); | |
var emails = ["[email protected]","[email protected]"]; | |
async.eachLimit(emails,1000,function(singleEmail,callback) { | |
// Emailer code | |
// singleEmail will be one value at a time. | |
},function(err,data) { | |
// Once all done, comes here. | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var async = require('async'); | |
var emails = ["[email protected]","[email protected]"]; | |
async.each(emails,function(singleEmail,callback) { | |
async.waterfall([ | |
function(callback) { | |
// code to send email. | |
callback(null,Flag); | |
}, | |
function(emailSentOrNot,callback) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var async = require('async'); | |
async.forEach(someData,function(singleData,callback){ | |
async.series(); | |
//OR | |
async.paralle(); | |
//OR | |
async.waterfall(); | |
},function(err,data) { | |
// final callback |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var async = require('async'); | |
// Send email | |
var sendEmail = function(email,callback) { | |
console.log("Sending email to "+email); | |
callback(null); | |
} | |
// create a queue object with concurrency 2 | |
var q = async.queue(sendEmail,2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Go to DigitalOcean and <a href="https://m.do.co/c/31513addbd1b" target="_blank">login</a> to your account, create one if not already. | |
Create new Droplet ( Server ) and choose latest Ubuntu. Refer the image below for reference. | |
<img src="https://codeforgeek.com/wp-content/uploads/2016/12/dropet-1024x517.gif" alt="digitalocean droplet" width="640" height="323" class="aligncenter size-large wp-image-2763" /> | |
DigitalOcean will create new Droplet and send you an e-mail containing the credentials to log-in your Server. You can use <strong>SSH</strong> or putty ( For Windows User ) to login to your Server. | |
Once you are logged on, do the system update first using the following command. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* NodeJS beefree.io integration | |
*/ | |
const https = require('https'); | |
const querystring = require('querystring'); | |
/** | |
* Fetch access token from beefree api | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Express HTML</title> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css"> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap-theme.min.css"> | |
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script> | |
</head> | |
<body> | |
<div style="margin:100px;"> |