QUESTPIE
Integrate FrontendAdapters

Next.js Adapter

Serve QUESTPIE APIs with Next.js API routes.

The Next.js adapter integrates QUESTPIE with Next.js API routes.

Install

bun add @questpie/nextjs

Setup (App Router)

app/api/[...slug]/route.ts
import { createFetchHandler } from "@questpie/next";
import { app } from "#questpie";

const handler = createFetchHandler(app, { basePath: "/api" });

export const GET = handler;
export const POST = handler;
export const PATCH = handler;
export const DELETE = handler;

TanStack Start

TanStack Start does not have an adapter package. Use the generic fetch handler:

src/routes/api/$.ts
import { createAPIFileRoute } from "@tanstack/react-start/api";
import { createFetchHandler } from "questpie";
import { app } from "#questpie";

const handler = createFetchHandler(app, { basePath: "/api" });

export const Route = createAPIFileRoute("/api/$")({
	GET: ({ request }) => handler(request),
	POST: ({ request }) => handler(request),
	PATCH: ({ request }) => handler(request),
	DELETE: ({ request }) => handler(request),
});

On this page