If you encounter a problem that you think someone else solved already, there’s a good chance that you can find a design pattern for it. Design patterns are “blueprints” prepared in a way to solve one (or more) problems in a way that’s easy to implement and reuse. It also helps your team to understand your code better if they are familiar with that specific design pattern – so before you try to solve a problem on your own, it’s worth trying to find a design pattern for it.
What Does Require Do
When a module is loaded using the require() function, the module’s code is executed and the exports object of the module is returned. The require() function can be used to load local files as well as modules installed from npm.