node.js中require的问题
PHPz
PHPz 2017-04-17 16:11:26
0
1
469

举个例子:在一个项目的主程序server.js中引入mongoose模块,又在另一个文件use.js中给mongoose定义格式和自定义方法,最后在sever.js引入这个文件,可在use.js为什么又要引入mongoose模块,主程序server.js中不是以及经引入了么?
求大佬告知

PHPz
PHPz

学习是最好的投资!

reply all(1)
洪涛

The use module is only referenced by the server, but mongoose is required in use. It is not defined and still needs to be introduced.
http://www.infoq.com/cn/articles/nodejs-module-mechanism

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template