Skip to main content
[Edit removed during grace period]
Link
John Militer
  • 813
  • 4
  • 15
  • 29
[Edit removed during grace period]
Link
John Militer
  • 813
  • 4
  • 15
  • 29
Source Link
John Militer
  • 813
  • 4
  • 15
  • 29

How can I make node.js automatically load config files?

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?