In this unit, you install and run the ECMAScript 5 version of the Employee Directory application that we use as a starting point for this tutorial:
Follow the instructions below to install the ECMAScript 5 version of the application:
Clone the es6-tutorial-data repository:
git clone https://github.com/ccoenraets/es6-tutorial-data
Navigate (cd
) to the es6-tutorial-data
directory.
Type the following command to create a package.json
file:
npm init
Press the Return key in response to all the questions to accept the default values.
Install http-server in your project. http-server is a lightweight web server we use to run the application locally during development and avoid cross domain policy issues when loading data using XMLHttpRequest.
npm install http-server --save-dev
Open package.json
in your favorite code editor. In the scripts
section, remove the test script, and add a script named start that starts the local web server. The scripts
section should now look like this:
"scripts": {
"start": "http-server"
},
On the command line, type the following command to start the HTTP server:
npm start
If port 8080 is already in use on your computer, modify the start script in package.json
and specify a port that is available on your computer. For example:
"scripts": {
"start": "http-server -p 9000"
},
Open a browser and access http://localhost:8080 to run the application.