Create your own module in Nodejs

Exports

Direct exports function declaration

Create new file mydate.js and write the following code

Export after function declaration

Declare function and write the definition. Then exports.

Or, without using function, write the following codes

Module.exports

Importing the Modules

Use require — assign the result to a variable. This can then be used to invoke any methods the module exposes

Software engineering and film. All are work-in-progress.