1

In my mac os x computer, node.js, you can use 'require()' to load your configuration files, but I am tired of having to do that on all my programs. Is there a way to make node.js automatically load config files? I tried to put this in my .bash_profile:

alias node='node var config = require("./config")'

When I enter the node command, it does load the file, but it exits the node shell. Is there a way to do this without making it exiting the node shell?

1 Answer 1

1

Use -r switch instead.

e.g node -r ./config.js

It will preload that module, and keep the shell for you.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .