Summary

In this chapter, first we set up Webpack to produce a separate bundle for the server, then we wrote a simple webapp using Koa 2 that used D3's Voronoi geom to find the nearest airport to a particular latitude/longitude pair. We then upgraded our server app to draw a map using D3 and Canvas, which we then outputted to the user as a PNG via a base64-encoded string.

Wasn't that all really pretty weird, but also kind of fun? Writing server-side code is like that. However, it can also be really rather cathartic after spending a bunch of time doing frontend development, which tends to be really finicky due to having to support so many devices. Furthermore, although purely client-side single-page applications were popular for a while, webapps are increasingly pre-rendered via a server, then rehydrated once they arrive for the user. It's never been more important for frontend developers to have at least a passable understanding of what's going on behind the scenes.

There's clearly quite a lot more you could learn about this topic that I just simply don't have room to cover here. We didn't go at all into scalability (which is super important when building things for large audiences, such as in the newsroom), nor into how to properly architect a nontrivial application; for that I'd recommend installing a few Express-based Yeoman generators and seeing how they scaffold projects (I'm particularly a fan of generator-angular-fullstack), or checking out Alexandru Vlăduțu's Mastering Web Application Development with Express (Packt, 2014). Koa is very similar to Express, and embraces a lot of its idioms (in some ways, it's even Express' spiritual successor), so you'll get a lot of mileage out of Express tutorials (alas! There aren't yet that many for Koa 2).

You now have a pretty full toolbox for confronting a very wide array of data visualization challenges. In the next chapter, we'll add a few more tools to it -- linting, unit testing, and static typing -- in order to help you have more confidence in the work you produce.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset