3 min read
Category: Node.js
6 min read Jump links Prepare the application for deployment Configure the Node.js server to listen on all network interfaces Set a Node.js version in package.json Set up the Fly CLI We’ll use the Fly CLI for creating, configuring and deploying our application to Fly. We can follow the Installing flyctl documentation to install the Fly CLI. Once […]
4 min read Jump links Fastify hooks and encapsulation contexts Example of an onSend hook Set headers for a collection of routes Set headers for all server routes Approach 1: Register an onSend hook in the server’s root context Approach 2: Register an onSend hook inside a plugin and wrap it with fastify-plugin Useful links
3 min read 🌟 New features 🎞️ Video walkthrough 💎 Other notable features 📅 Node.js releases
Get started with validation in Node.js
4 min read A powerful validation duo Creating a schema and validating data Schema generation Try it yourself Wrapping up Further reading
< 1 min read
How to cancel an HTTP request in Node.js
5 min read The Abort API Cancelling an HTTP request with an AbortSignal Support for cancelling HTTP requests Wrapping up
7 min read Jump links What’s your use case? Framework styles Support for promises and async / await Documentation Practical examples Community and ecosystem Project health Conclusion
< 1 min read
< 1 min read
< 1 min read Links
5 min read Jump links The middleware pattern Middleware syntax The two types of middleware Plain middleware Error handling middleware Using middleware At the route level At the router level At the application level Wrapping up
12 min read Jump links What are the benefits of migrating from Express to Fastify? How to Migrate an API with Confidence Transitioning from Express to Fastify with fastify-express Our Example Express Application Required dependencies The router module The app module The server module Running our application Migrating Our Application from Express to Fastify Required dependencies Refactoring our […]
Notes from CityJS Conference 2021
17 min read Jump links Talk: Deno and TypeScript: The Good, The Bad and The Ugly Talk: Supercharge your JavaScript with WebAssembly Talk: New and experimental features in Node.js core Talk: 10 secrets to improve Node.js Security Talk: The Third Age of JavaScript Talk: Next-gen Frontend tooling Talk: Authentication, authorisation and security for modern client-side applications Talk: A […]
< 1 min read
5 min read Jump links Support for async code in Node.js What does framework “native support” for async code look like? What happens when a framework doesn’t natively support async code? Which Node.js frameworks natively support async code? How to write async code safely in Node.js Build new projects with a framework which natively supports it Migrate existing […]
< 1 min read Links
5 min read Jump links Request flow with a proxy server Create a server with Fastify Add and configure the fastify-http-proxy plugin Add an API key to proxied requests HTTP request header URL query string Conclusion
7 min read Jump links Several names for the same thing Which versions of Node.js have full support for ES modules? Why are ECMAScript modules marked as ‘Experimental’ in the Node.js documentation? ES and CommonJS modules play nice together (mostly) Use ES modules when you start a new Node.js project It’s probably not worth migrating your existing Node.js […]
< 1 min read Links
9 min read Jump links Introducing the ‘Problem Details for HTTP APIs’ specification Problem types and Problem details objects Example problem details response More details, clearer problems Breakdown of a problem details object How to send problem details responses with Express Define problem types and map them to JavaScript error classes Look up the problem details for an […]
7 min read Jump links Getting errors to error handler middleware Creating an error handler Error handler concerns Error handler middleware function Error handler helper functions Applying the error handler middleware Example error response Next steps Getting errors to error handler middleware Creating an error handler Error handler concerns Error handler middleware function Error handler helper functions Applying […]
9 min read Jump links Getting to grips with JSON Schema Why should I use JSON Schema and not validation library X? How to integrate validation with JSON schemas into your application Pulling it all together Wrapping things up Handy JSON Schema links
Notes from NodeConf Remote 2020
9 min read Talk: Aaaaaaaaaaaaaah, They’re Here! ES Modules in Node.JS Talk: Can we double HTTP client throughput? Talk: AsyncLocalStorage: usage and best practices Talk: Examining Observability in Node.js Talk: Node.js startup performance
6 min read When you’re building an API with Express it can be difficult to know how to send consistent error responses. The framework doesn’t seem to provide any special features for this, so you’re left to figure it out on your own. At some point you’ll probably find yourself wondering if you’re doing it “the right way”.
6 min read
5 min read Node.js v14.13.0 introduces support for named imports from CommonJS modules. Sounds great, right? But I realised I had no idea what this actually meant. Join me on my journey of discovery!
4 min read Jump links Enable the full use of promises and async / await 2. Validate request data with JSON Schema 3. Use an existing format for error responses 4. Send CORS response headers so web pages can call your API 5. Separate your concerns
3 min read
3 min read