The process Object: Args, Env, Exit Codes
On this page
The process Object
The global process object provides information about the current Node runtime instance.
Command Line Arguments
console.log(process.argv);
Environment Variables
console.log(process.env.PORT);
Exit Codes
process.exit(1);
Graceful Shutdown
process.on('SIGTERM', () => {
console.log('Shutting down...');
});
Production Rule
Always handle shutdown signals to close database connections and stop accepting new requests gracefully.