The module object in nodejs is what I often use when creating modules in nodejs. The module exports property of the module object is what I use to return a main function that will be called when using the module elsewhere. In addition the main function that I exports with the module export propriety can have additional properties attached to it which in many respects makes it a better option to the exports global that can also be used to set public methods and properties for a module that I might be making for a nodejs project.
A good basic example of the module exports method might be to just have a simple add function that I set to the module exports property. Just create a method and asign it to the moduel exports property and save the file as something like add.js in a working folder.
So now for a slightly more advanced version of a nodejs module. This time something with a single private methods, and attaching at least one static methods to the main public method.
Say I want to start a simple point module that can be used to create a point object. In this module I have a single private helper methods that is used to parse arguments that does not need to be public. In adddiot9n to the main public methods that is used to create point methods I have at least one additional static methods that can return a result when given one or more point objects. For starters maybe just a distance formula that will return the distance between two give points.
If for some reason I need to get the file name of the current module that I am working on, one way to do so would be to use the module objects filename property.
I often just use the exports property of the module object over the exports object as a way to export what I am making when designing a nodejs module. In the wild you might see the use of the exports global as a way of just attaching some static methods for the module without a main method for the module. This is yet another way of going about doing so when it is a module that will just be a collection of static methods. Event then I can still have a similar effect by assigning just a plain object to the module exports property anyway.