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 information
- Save and run the scripts
You are a DevOps engineer and you're tasked with deploying a Node.js API server. Developers worked for months on this app and now the 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 is on. In other words, this lab will test you how well you know and can utilize process information. For example, global
has other global objects like process
, while global.process
or just process
has system information.
- Create a script
version.js
which exports the current node version. Export withmodule.exports = {your code here}
- Create a script
envvar.js
which returnsNODE_ENV
environment variable. Export withmodule.exports = {your code here}
- Create a script
platform.js
which returns the platform name on which you are running it. Export withmodule.exports = {your code here}
- Run
npm test
to verify your 3 solutions
View node-process-lab on Learn.co and start learning to code for free.