mirror of
https://github.com/kou029w/_.git
synced 2025-01-31 06:18:07 +00:00
18 lines
450 B
TypeScript
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);
|
|
}
|