Skip to content

Instantly share code, notes, and snippets.

@saturngod
Created August 16, 2011 16:08
Show Gist options
  • Save saturngod/1149438 to your computer and use it in GitHub Desktop.
Save saturngod/1149438 to your computer and use it in GitHub Desktop.
sample module in node.js
exports.division=function(num1,num2,callback) {
if(num2 <=0 ) {
callback("num2 shouldn't be less than or equal zero");
}
callback (null,num1/num2);
}
var div = require("./div.js");
div.division(8,2,function(err,result){
if(err==null) {
console.log(result);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment