- Learning D3.js Mapping
- Thomas Newton Oscar Villarreal
- 361字
- 2021-08-06 19:42:42
Step-by-step bootstrap
The next section covers detailed instructions to set up your development environment to rapidly create visualizations in later chapters. By the end of the chapter, you will have a working environment for the rest of the book (an example of a map running and an initial look at tools used to create visualizations).
A lightweight web server
Technically, most of the content we will craft can render directly in the browser without the use of a web server. However, we highly recommend you not to go ahead with this approach. Running a web server in your local development environment is extremely easy and provides several benefits:
- Geographic information, statistical data, and visualization code can be clearly separated into isolated files
- API calls can be stubbed and simulated, allowing easy integration into a full-stack application in the future
- It will prevent common mistakes when making AJAX calls to fetch geographic and statistical data (for example, the same-origin policy)
For our choice of the web server and other tools in our toolbox, we will rely on a Node.js package named http-server
. Node.js is a platform built on Chrome's JavaScript runtime, which is used to build fast, scalable network applications. The platform includes Node Package Manager (npm), which was created by other members of the vibrant Node.js community and allows the developer to quickly install packages of prebuilt software.
To install Node.js, simply perform the following steps:
- Go to the website http://nodejs.org.
- Click on the INSTALL button.
- Open the downloaded package and follow the defaults.
To test the installation, type in the following in the command line:
node –v v0.10.26 # or something similar should return
Now that Node.js and npm are installed, we can proceed to install the web server. When the web server is installed globally with the –g
command, it becomes easily accessible throughout the system.
Once on the command line, enter the following:
npm install -g http-server
You can quickly verify the package was installed by typing the following:
http-server
Then open your web browser to http://localhost:8080
. The browser should display a list of all the files in the directory from where you initiated the command.
- Dreamweaver CS3 Ajax網(wǎng)頁設(shè)計(jì)入門與實(shí)例詳解
- 電氣自動(dòng)化專業(yè)英語(第3版)
- 基于LabWindows/CVI的虛擬儀器設(shè)計(jì)與應(yīng)用
- Hands-On Machine Learning with TensorFlow.js
- Windows環(huán)境下32位匯編語言程序設(shè)計(jì)
- 自動(dòng)控制理論(非自動(dòng)化專業(yè))
- 大學(xué)C/C++語言程序設(shè)計(jì)基礎(chǔ)
- Nginx高性能Web服務(wù)器詳解
- 分析力!專業(yè)Excel的制作與分析實(shí)用法則
- 中老年人學(xué)電腦與上網(wǎng)
- 數(shù)據(jù)庫基礎(chǔ):Access
- Raspberry Pi 3 Projects for Java Programmers
- Mastercam X5應(yīng)用技能基本功特訓(xùn)
- Hadoop大數(shù)據(jù)開發(fā)基礎(chǔ)
- Machine Learning for Healthcare Analytics Projects