Skip to content

Instantly share code, notes, and snippets.

@theJian
Created September 15, 2015 07:13
Show Gist options
  • Save theJian/2437b6225f32e0d8b4be to your computer and use it in GitHub Desktop.
Save theJian/2437b6225f32e0d8b4be to your computer and use it in GitHub Desktop.
NodeJs 模块

当模块的文件名是index.js,加载模块时可以使用模块所在目录的路径代替模块文件路径,以下两条语句等价。

var cat = require('/home/user/lib/cat');
var cat = require('/home/user/lib/cat/index');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment