Vercel + Fastify Hello World

This is a starter template for Vercel + Fastify. Requests are rewritten from /* to /api/*, which runs as a Vercel Function.

For example, here is the boilerplate code for this route:

import Fastify from 'fastify'

const app = Fastify({
  logger: true,
})

app.get('/', async (req, res) => {
  return res.status(200).type('text/html').send(html)
})

export default async function handler(req: any, res: any) {
  await app.ready()
  app.server.emit('request', req, res)
}
    

Deploy your own to get started.