liveBook · Manning

Node.js

As explained in Web Components in Action

Node.js is a JavaScript runtime built on the V8 engine for executing JavaScript outside the browser.

Node.js provides a practical local development server when opening an HTML file directly blocks its assets, CSS, or JavaScript. It also supplies NPM for installing project tooling and browser-support packages. section 2.6 section 2.7

A minimal Node.js workflow for testing a component is:

  • Install Node.js, then use NPM to install the http-server module globally. section 2.6
  • Create a project folder and a small HTML file, then run http-server from that folder. section 2.6
  • Open the reported local URL in a browser and load the Web Component with its assets. section 2.6

Serve a component locally

Run `npm install http-server -g`, change into the project folder, and run `http-server`. The command reports local addresses such as `http://127.0.0.1:8080`; opening one lets you test the HTML page and photo carousel in a browser. section 2.6

npm install http-server -g

Use the supplied NPM command listing as the shortest starting point for installing the local server. section 2.6

http-server

Use the supplied server command listing to serve the current project directory. section 2.6

How Web Components in Action covers it

How deep it goes
Provides installation and execution steps, but stops short of explaining Node.js runtime internals or server implementation.
Examples
Uses a test HTML page, the http-server command, a photo carousel, and an NPM-installed custom-elements polyfill.
What it assumes
Assumes a command-line terminal, a project folder, an HTML file, and basic browser testing; installation starts from zero.
What you can do after
Operate a local HTTP server and install browser-support packages through NPM.
How it connects
Connects Node.js with NPM, HTTP servers, Web Components, custom elements, polyfills, and browser compatibility.

Also explained in

Compare how 4 books explain Node.js →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Web Components in Action. The section links point to the parts of the book it draws on.