nodejs导出导入
In my previous posts, we have discussed about “How to install Enide Studio 2014 IDE” and also “How to create a Node JS Application“.
在我以前的文章中,我们讨论了“ 如何安装Enide Studio 2014 IDE ”以及“ 如何创建Node JS应用程序 ”。
Before discussing about “How to create new Node JS Modules and How to reuse them in other Node JS Modules”, first of all we need to have some good knowledge about how to export and import a Node JS module.
在讨论“如何创建新的Node JS模块以及如何在其他Node JS模块中重用它们”之前,我们首先需要对如何导出和导入 Node JS模块有一定的了解。
In this post, we are going to discuss the following two important Node JS concepts theoretically.
在本文中,我们将从理论上讨论以下两个重要的Node JS概念。
- How to export a Node JS Module 如何导出Node JS模块
- How to import a Node JS Module 如何导入Node JS模块
We will use this knowledge especially in next post, but also in all my coming post’s examples.
我们将在以后的文章中特别是在以后的例子中使用这些知识。
导出节点JS模块 (Export a Node JS Module)
First and foremost thing we need to understand is why we need to export a Node JS Module?
我们首先要了解的是为什么我们需要导出Node JS模块?
Node JS has provided almost all required modules (We can check this updates on its official website: https://www.npmjs.com/. It is also known as Node JS Module Repository). But in some realtime applications, we may have some application functionality, which is used many places in that application but not avai