Posts tagged 'nodejs'
Tag: nodejs
Bringing Class-Based Views to Fastify (Inspired by Django) Signature Post
Why doesn’t Node.js have something like Django’s Class-Based Views (CBVs)?
I love Django key features like its class-based views or ORM, and I usually miss them when working with Node.js. So yesterday night, in the middle of my usual insomnia, I wondered if anyone had already built something like that for Node.js.
I did a quick search, and what I found were just a few experiments from ~8–9 years ago. Nothing robust, modern, or maintained.
Django Class-Based Views (CBVs) provide a clear structure, lots of built-in functionality, and still enough flexibility to adapt them to different use cases. So I decided to sketch out a design for Fastify (and Node.js in general) that feels natural to use, contract-first, and TypeScript-friendly. This post is a walk-through of that exploration during the rest of the Sunday.
How to migrate from Jest to node:test
Jest is one of the most populars testing frameworks for Javascript and Node.js. Originally developed by Facebook, it’s a one-stop-shop with testing, assertions, code coverage… but this implies some critics, like requiring more than 50mb of dependencies. Also, somewhat recently was shown to be maintained mostly by a single person, being that the reason why updates and maintenance was so much slow, so they decided to transfer it to OpenJS foundation. Also there has been several long standing critics about not providing a pure environment, or the fact that Jest parses the code, leading to some complexities when needing to configure transpilation. That has lead to several people looking for alternatives, and having now a built-in test runner in Node.js, I decided to see myself how to migrate to it.
How to (properly) deploy Node.js applications Signature Post
Recently I’ve been involved in a new Typescript project all of my own where I would end up deploying it on production on a raw AWS machine, so no help from dev friendly PaaSs environments, as I usually prefer to work.
redux-offline in Node.js
Experimenting with
redux-offline, I’ve done a
Proof-of-Concept about how to use
redux-offline in a Node.js environment,
like a CLI command. This is useful for example when it’s needed to do an offline
aware application that needs to queue some operations until it’s connected
again.