Code examples to provide an overview of Progressive Web Apps
The site needs to be served up on localhost
using a webserver.
The steps below show how this can be achieved using express
(and the serve-index
package to show directory listings).
- Install
express
and theserve-index
package with the commandnpm install
. - Start the server with the command
node express
- With the server running, visit the site: http://localhost:8080.
For the later examples where AJAX JSON requests / responses are sent to the server, the node package json-server
is required.
- Install
json-server
globally with the commandnpm install -g json-server
- Start the server by running
json-server --watch database/db.json
.
VSCode has an extension Code Runner
which allows JavaScript files to be run inside of VSCode.
The keyboard shortcut is Ctrl+Alt+N.
The Atom editor has a package atom-runner
which allows JavaScript files to be run inside of Atom.
The keyboard shortcut is Alt+R
(or Ctrl+R
on a Mac).
git config user.name
git config user.name "Mona Lisa"
git config user.email
git config user.email "email@example.com"