简体   繁体   中英

Node.js: Which module to “require('..')” to use socket.io?

In https://github.com/socketio/socket.io/blob/master/test/socket.io.js

The code:

在此处输入图片说明

What is the module name to require?

它需要父目录中的模块-在本例中为socket.io

A folder can be used as a module if that folder contains, index.js or package.json files etc.

So in this case it is requiring the socket.io.js file in the above folder.

Also if a package.json and index.js file are in the same folder the package.json will get look up priority.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM