Node.js

37 cards   |   Total Attempts: 188
  

Cards In This Set

Front Back
What is Node.js?
Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient. Node.js' package ecosystem, npm, is the largest ecosystem of open source libraries in the world. - Node.js In software development, Node.js is an open-source, cross-platform runtime environment for developing server-side Web applications. Although Node.js is not a JavaScript framework, many of its basic modules are written in JavaScript, and developers can write new modules in JavaScript. The runtime environment interprets JavaScript using Google's V8 JavaScript engine. - WikiPedia
Who created Node.js?
Node.js was developed by Ryan Dahl in 2009.
What JavaScript engine is used in Node.js?
V8
Who developed this JavaScript engine? Where did it come from?
Chrome V8, or simply V8, is an open source JavaScript engine developed by The Chromium Project for the Google Chrome web browser. It has been used in many other projects, such as Couchbase, MongoDB and Node.js that are used server-side.
What API is not available to Node.js that would be in Google Chrome for example?
Any APIs that you're used to working with in the browser (BOM) are not available in Node.js.
Why is Node.js not a framework?
Framework: this describes a given structure of "how" you should present your code. Pretty much like a code-template, along some helpers, constructors etc. to solve/simplify a specific problem or bring your architecture in "order". Examples, "Backbone", "requireJS", "socketIO". A runtime environment basically is a virtual machine that runs on top of a machine - provides machine abstraction. It is generally lower level than a library. A framework can contain a runtime environment, but is generally tied to a library.
What is the Node.js install wizard?
The install system for Node.
What is NVM and what is it used for? Why is it useful?
Node Version Manager allows you to switch between Node.js versions on a project by project basis.
Why might you want multiple versions of Node.js installed on your machine?
If you have multiple node projects some might need to be run on different versions of node.
How can you check if Node.js is installed on your machine?
In the terminal type: $ node> console.log('Hello Node.js!');#=> Hello Node.js!
How can you check if NVM is installed?
$ nvm
How do you switch between versions of Node.js using NVM?
# Run a file with a specific Node.js version$ nvm run 5.8.0 index.jsRunning node v5.8.0 (npm v3.7.3)
What is a Node.js module?
Node.js uses files as modules. Think of a module as just a reusable piece of code, any code, of any size.
How do you make code publically available from a module?
You can make code public from a module by setting module.exports equal to the value you want your module to have when required.
What is the difference between module.exports and exports?
Module is a plain JavaScript object with an exports property. exports is a plain JavaScript variable that happens to be set to module.exports. At the end of your file, node.js will basically 'return' module.exports to the require function. A simplified way to view a JS file in Node could be this: var module = { exports: {} };var exports = module.exports; // your code return module.exports;If you set a property on exports, like exports.a = 9;, that will set module.exports.a as well because objects are passed around as references in JavaScript, which means that if you set multiple variables to the same object, they are all the same object; so then exports and module.exports are the same object.But if you set exports to something new, it will no longer be set to module.exports, so exports and module.exports are no longer the same object.