Skip to content

API routes does not register with .civet filename #2

@nilskj

Description

@nilskj

SolidStart cannot parse API routes with .civet filetype. It is perceived as a normal page route even though it has exported GET and POST. My example with a trpc API route, src/routes/api/trpc/[...].civet:

import { APIEvent } from "solid-start/api";
import { fetchRequestHandler } from "@trpc/server/adapters/fetch";
import { appRouter } from "~/lib/router.civet";

const handler = (event: APIEvent) =>
  fetchRequestHandler({
    endpoint: "/api/trpc",
    req: event.request,
    router: appRouter,
    createContext: () => ({}),
  });

export const GET = handler;
export const POST = handler;

Unless I rename it and write it in normal typescript, it won't register as an API route. src/routes/api/trpc/[...].ts works fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions