Export message.js


                                            module.exports = 'Hello world';

//or

exports = 'Hello world';
                                        

Import app.js


                                            var msg = require('./Messages.js');

                                            console.log(msg);
                                        

I n programming, modules are self-contained units of functionality that can be shared and reused across projects. They make our lives as developers easier, as we can use them to augment our applications with functionality that we haven’t had to write ourselves. They also allow us to organize and decouple our code, leading to applications that are easier to understand, debug and maintain.