Skip to content

Instantly share code, notes, and snippets.

@JacobHsu
Created November 3, 2014 07:54
Show Gist options
  • Save JacobHsu/01b177ce8425162456ff to your computer and use it in GitHub Desktop.
Save JacobHsu/01b177ce8425162456ff to your computer and use it in GitHub Desktop.
#nodejs module.exports VS. exports.function
var url = require("url");
exports.fun = function (postReq, my_callback){
var fileName = url.parse(postReq.fileurl).pathname.split('/').pop();
my_callback('fileName=' + fileName);
}
var url = require("url");
module.exports = function (postReq, my_callback){
var fileName = url.parse(postReq.fileurl).pathname.split('/').pop();
my_callback('fileName=' + fileName);
}
var outvarBack = require('./outvar_fun_name');
outvarBack.fun( req.body, function (result) {
console.log('[router]'+result);
});
require('./outvar_fun_noname')(req.body, function (result) {
console.log('[router] '+result);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment