Globals

Like the Browser, Node.js comes with some practical globals for us to use in our applications.

Common

  • global Think of this as like window but for Node.js. DON'T ABUSE IT!
  • __dirname This global is a String value that points the the directory name of the file it's used in.
  • __filename Like __dirname, it too is relative to the file it's written in. A String value that points the the file name.
  • process A swiss army knife global. An Object that contains all the context you need about the current program being executed. Things from env vars, to what machine you're on.
  • exports module require These globals are used for creating and exposing modules throughout your app.

Children
  1. global
  2. process