Zach Leat recently created a cloud function that dynamically generates sparklines. Under the hood sits the the sparkline-svg package to generate the SVG. The datapoints themselves can be passed in via the URL.
It’s an SVG file with a snippet of JS contained inside it, a technique originally developed by Stuart Langridge. On load it will draw the sparkline, using the values as passed in the via the querystring.
Upside with this approach is that you can host this SVG file on your own servers, without needing a cloud function. Downside however is that you need to include the SVGs via <embed> — to allow script execution — and require JS on the client to show them properly.
It’s been a while since I’ve set up a server with Node, but turns out Fastify is preferred over Express nowadays.
Fastify is a web framework highly focused on providing the best developer experience with the least overhead and a powerful plugin architecture. It is inspired by Hapi and Express and as far as we know, it is one of the fastest web frameworks in town.
With Node 12 and up supporting ES Modules natively and Node 10 — the last version to not support it unflagged — going EOL, it’s time to start migrating your code to ES Modules. Aral Balkan took the time to convert his tool “Place” to embrace them and documented his work:
How do we create a package that exposes both CommonJS & ES modules while making sure we don’t break cross-platform support? Publishing 2 separate packages is an option (e.g. lodash/lodash-es). But there is a nicer, more maintainable option that obviates the need to publish twice. We can provide an extra build step that creates an ES version of our package and links it via package.json.
Ryan Dahl – inventor of Node.js – has been working on Deno, a new take on Node as if it were designed today.
I especially like the compatibility with ES Modules.