By Glitch Team

June 24, 2022

Smarter starters and better error handling, thanks to Fastify 4!

All of our Glitch Node.js starter projects use the efficient and flexible server framework Fastify. The Fastify team recently released a major update–version 4 includes a number of improvements, but you will need to make a few changes to any existing remixes you created on Glitch before we updated the starters to use it. Read on to learn more!

Version 4 changes #

You can read all about the changes in Fastify 4 in the announcement blog post–here are a few highlights:

Updating your existing apps #

Fastify in the package JSON dropdown

When you edit a Node.js app in Glitch, you can manage your npm dependencies in the package.json file using the dropdown list that shows you any packages that have updates available. If you have a remix of Hello Node, Hello SQLite, or the blank / minimal versions of either of these starter projects, you’ll see the Fastify 4 update in the dropdown list–but you’ll need to make a few additional changes to get your app working with the new version.

Fastify 4 requires at least Node version 14, and there are some packages the starters use that have been deprecated and replaced–there are also a couple of minor server syntax changes.

In your project, open the Logs so that you see the progress unfold. Don’t worry when you see the little sweary face in your app Status at the bottom of the Glitch editor as you carry out the updates–it’s all part of the fun and they’ll turn happy again by the time you’re done!

App status in the Glitch editor

Check out the help doc for detailed steps, here’s the TLDR; on what you’ll need to change:

Give Glitch a little time to update and rebuild your project between steps and hopefully it’ll work the way you expect! If you have any issues take a look in the Logs, and turn on detailed logging in your server JS file if necessary.

Detailed error logging

Check out the updated starters to see the new syntax in action:

*Those two beautiful cheetah photographs at the top of the post were taken and shared with the commons by William Warby and James Temple 🐆