module.exports vs exports in Node.js

前端 未结 23 1659
自闭症患者
自闭症患者 2020-11-22 06:11

I\'ve found the following contract in a Node.js module:

module.exports = exports = nano = function database_module(cfg) {...}

I wonder what

23条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-22 07:02

    1.exports -> use as singleton utility
    2. module-exports -> use as logical objects such as service , model etc

提交回复
热议问题