In: Computer Science
use any online document and ppt provided to answer the following question
1. What is Node js and In which Language Node Js is written?
2. Explain CLI in Node.js and provide a command to install locally or globally?
3. Explain Modules in Node Js and provide an example you would use for an API?
4. What are Common Js Modules describe the most important ones ?
5. For what require() is used in Node Js ?
exports
objects.6. Explain What is a Javascript Engine, what is javascript framework , and what is ECMAScript
7. write a command to get a node js installed in your machine and how you upgrade or downgrade from the current version ?
sudo npm install -g n
sudo n stable [to install latest stable version of node.js]
Command to downgrade Node.js from the current version...
node -v [prints the current version of node.js]
nvm install
[install the version of node.js that is required, the version should be older than the current one installed]
nvm use
[use the newly installed version of node.js(a downgraded
node.js)]
8. Explain What is NPM and when do you use it. provide an example illustrating use of NPM
npm is also a software Package Manager and Installer.
npm is the package manager for the Node JavaScript platform. It puts modules in place so that node can find them, and manages dependency conflicts intelligently
When to use NPM...
it is used to publish, discover, install, and develop node programs.
Example illustrating the use of NPM...
Install Modules with npm install
[this npm command is
used to install modules to node framework]
9.
How to stop master process without
suspending all of its child processes?
When using a process management system like
upstart
, it's entirely possible that the parent
process could be respawned, creating a whole new generation of
worker processes in addition to the orphaned processes. So, when
the parent process dies ungracefully, none of the spawned child
processes are killed.
10. What does emitter do and what is dispatcher. write example for each ?
// Import events module var events = require('events'); // Create an eventEmitter object var eventEmitter = new events.EventEmitter();
11. Explain module.exports in Node Js ?