Created
November 3, 2014 07:54
-
-
Save JacobHsu/01b177ce8425162456ff to your computer and use it in GitHub Desktop.
#nodejs module.exports VS. exports.function
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 url = require("url"); | |
exports.fun = function (postReq, my_callback){ | |
var fileName = url.parse(postReq.fileurl).pathname.split('/').pop(); | |
my_callback('fileName=' + fileName); | |
} |
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 url = require("url"); | |
module.exports = function (postReq, my_callback){ | |
var fileName = url.parse(postReq.fileurl).pathname.split('/').pop(); | |
my_callback('fileName=' + fileName); | |
} |
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 outvarBack = require('./outvar_fun_name'); | |
outvarBack.fun( req.body, function (result) { | |
console.log('[router]'+result); | |
}); |
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
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