I am developing a node.js app, and I want to use a module I am creating for the node.js server also on the client side.
An example module would be circle.js:
<
This seems to be how to make a module something you can use on the client side.
https://caolan.org/posts/writing_for_node_and_the_browser.html
mymodule.js:
(function(exports){
// your code goes here
exports.test = function(){
return 'hello world'
};
})(typeof exports === 'undefined'? this['mymodule']={}: exports);
And then to use the module on the client:
This code would work in node:
var mymodule = require('./mymodule');