Training Guide: Programming in HTML5 with JavaScript and CSS3 Ebook

(Nora) #1

Lesson 1: Getting started with Node.js CHAPTER 8 363


Quick check
■■What does the following command accomplish?
npm install

Quick check answer
■■This command reads the local package.json file and installs all dependent pack-
ages that are referenced.

Lesson summary


■■Node.js provides a server-side way of creating websites that are JavaScript-based.
■■A module is a shareable file that promotes reuse.
■■A package is a shareable set of modules that promote reuse and is published for you
and others to use.
■■Use node package manager (npm) to manage packages.
■■Use the express package to create a website easily.

Lesson review


Answer the following questions to test your knowledge of the information in this lesson. You
can find the answers to these questions and explanations of why each answer choice is correct
or incorrect in the “Answers” section at the end of this chapter.


  1. What can you publish by using npm?
    A. A JavaScript file
    B. A module
    C. A JavaScript class
    D. A package

  2. What scoping can a package have? (Choose all that apply.)
    A. Local
    B. Grouped
    C. Named
    D. Global

  3. Why would you install the express package?
    A. Simplify website creation
    B. Provide session management
    C. Simplify retrieval of static content
    D. All of the above

Free download pdf