1
0
Fork 0
mirror of https://github.com/kou029w/_.git synced 2025-01-30 22:08:02 +00:00
_/vercel-fastify/api/index.ts
2024-04-22 00:20:58 +09:00

18 lines
450 B
TypeScript

import autoload from "@fastify/autoload";
import type { VercelRequest, VercelResponse } from "@vercel/node";
import fastify from "fastify";
import path from "node:path";
const app = fastify();
app.register(autoload, {
dir: path.resolve(__dirname, "_routes"),
options: {
prefix: "/api",
},
});
export default async function handler(req: VercelRequest, res: VercelResponse) {
await app.ready();
app.server.emit("request", req, res);
}