Let\'s say I have a file called app.js. Pretty simple:
var express = require(\'express\'); var app = express.createServer(); app.set(\'views\', __dirname + \
Create two js files
// File cal.js module.exports = { sum: function(a,b) { return a+b }, multiply: function(a,b) { return a*b } };
Main js file
// File app.js var tools = require("./cal.js"); var value = tools.sum(10,20); console.log("Value: "+value);
Console Output
Value: 30