O'Reilly logo

Data Visualization: Representing Information on Modern Web by Swizec Teller, Ændrew Rininsland, Simon Timms, Andy Kirk

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

All aboard the Express train to Server Town!

Okay, let's get into the nitty-gritty right away and I'll explain what's going on. Add all of this into a new file called chapter6.js:

import express from 'express';
import bodyParser from 'body-parser';
import d3 from 'd3';
import {readFile} from 'fs';

import {nearestVoronoi} from './helpers';

let app = express();

app.use(bodyParser.urlencoded());

Here we're just importing all of our libraries; nothing to see here... Oh wait — didn't I say we have to use CommonJS because we're in Nodeville? No — because we're using Babel and Webpack to transpile all of our code, we can still use the lovely ES2015 module loading syntax without issue — even for Node.js modules that aren't themselves in ES6!

Anyway, we essentially ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required