Lowering Overhead with Fastify
NodeJS is one of the more common server hosting environments out there. We at Don’t Panic Labs tend to use .NET instead of NodeJS for the hosting of backend systems, but I like to use NodeJS for a lot of my experiments as it often forces me to learn new things.
When standing something up with NodeJS, I typically use Express as the backend framework. But when running experiments or learning something, I often try new things out.
I thought I’d try Fastify instead of Express for the backend framework. Fastify claims to be fast, much faster than Express. Fast meaning performance, or the ability to service requests.
My limited use of Fastify has been pleasant. I found its syntax easy to understand and very similar to express. If you want, there is even a plugin that allows you to directly use express syntax for configuring routes.
Setting up an HTTP handler in Fastify is straightforward. You create an instance of Fastify, then configure the ‘get’ method.
Fastify also has a very extensive plugin ecosystem to help handle a variety of common use cases (for example, JWT parsing).
If you need a NodeJS framework, give Fastify a try.