node.js - require name instead of file path -


I'm looking at some code on github.

Online 7 says this.

  var home = requirement ('home');  

home.js is in another folder. I'm thinking how it works, and how I can do it in my code.

You can find JSN. how does it work? It seems like a more clean way than direct file references. There are ways to refer to folders in the node as packages in the file system; npm links For example, a folder will be a module using the pretend simulation.

The package you are connected to is cheating a little bit, and I argue that when it looks like it is not quite clear it actually sets NODE_PATH Includes all controllers when the service runs:

Therefore all the control files such as home.js are officially available .js always Anyway, there is an alternative.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -