Speed up NodeJS server-side development with Webpack 4 + HMR.

When webpack 4.0 came out, I decided to migrate my codebase implementing webpack for the frontend to webpack 4.0.

One thing I hadn’t invested time to do however, is to enable HMR in my backend code. I have a project that takes approx 30 seconds to start up, mainly because of babel transpiling my whole codebase on memory before running my server, which takes a lot of time and resources. In production, I was using babel-node to transpile my entire code before actually running the backend server.

I decided to use webpack for my backend server and I achieved to speed up compilation by 40x.

Continue reading

Country border highlighting with Leaflet.js

Not too long ago I finished a project on Big Data for the University. One part of this huge project was the implementation of a dynamics map that would be responsive to mouse hover and mouse click. When the mouse would hover over a country, the whole country borders would be highlighted in the map, and if the user clicked inside those borders, we would display tons of interesting data using D3.js.

For map displaying and operations on Google Style maps, look no further than Leaflet.js.

All examples I found on the Internet would either not provide proper callbacks, or would not provide these features for the entire world map. Providing callbacks for a world map is extremely difficult in terms of performance optimisation, for reasons that will be explained below. For now, let’s briefly explain how it works.

Continue reading