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 ...

Get D3.js: Cutting-edge Data Visualization now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.