💾 Archived View for space.matthewphillips.info › posts › astro-fastify-two captured on 2023-04-26 at 13:00:10. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-01-29)
-=-=-=-=-=-=-
A new version of my Astro Fastify adapter has been released. You can see the release notes here:
https://github.com/matthewp/astro-fastify/releases/tag/v2.0.0
You'll want to install 2.0.1 as that contains a bug fix.
The big change in this release is support for TypeScript in your Fastify routes. The adapter allows you to specify an entrypoint that receives the Fastify object where you can do things like define routes and add plugins. Now that entrypoint can be TypeScript (or any other format compiled by Vite). For example:
import { defineConfig } from 'astro/config'; import fastify from '@matthewp/astro-fastify'; // https://astro.build/config export default defineConfig({ output: 'server', adapter: fastify({ entry: new URL('./api/index.ts', import.meta.url), }), });
Additionally the Fly.io starter has been updated to use the new version of @matthewp/astro-fastify, and to use TypeScript for the entrypoint, as well as some clean ups. You can get that here:
https://github.com/matthewp/astro-flyio-fastify-starter
Fly.io is a great choice as a host when using Astro, both with Fastify or with any other Node.js framework because it makes deployments so easy and you get the benefit of their global network.