In this lab, you'll need to demonstrate how to access global
and process
variables.
- Write a script that accesses global object
- Add logic to access process info
- Save and run the scripts
You are a DevOps engineer and you're tasked with deploying a Node.js API server. Developers worked months on this app and now team needs your expertise to push the app to production.
The server needs to be "smart" enough to get secret values from whatever OS or environment it on. In other words, this lab will test you how good you know and utilize process information. For example, global
have other global objects like process
, while global.process
or just process
have system information.
- Create a script
version.js
which returns the current node version. Export withmodule.exports = function(){...}
- Create a script
envvar.js
which returnsNODE_ENV
environment variable. Export withmodule.exports = function(){...}
- Create a script
platform.js
which returns the platform name on which you are running it. Export withmodule.exports = function(){...}
- Run
npm test
to verify your 3 solutions
View node-process-lab on Learn.co and start learning to code for free.