TanStackT
TanStack14mo ago
1 reply
sacred-rose

Issue with API File Route

I have set up the api route the same as on the documentation, the
this is my app/api.ts

import {
  createStartAPIHandler,
  defaultAPIFileRouteHandler,
} from "@tanstack/start/api";

export default createStartAPIHandler(defaultAPIFileRouteHandler);


and this is my route route/api/auth/signup/index.ts
import { createAPIFileRoute } from "@tanstack/start/api";

export const RegisterApi = createAPIFileRoute("/api/auth/signup")({
  POST: async (req) => {
    return new Response(JSON.stringify({ message: "Hello, World!" }), {
      headers: {
        "Content-Type": "application/json",
      },
    });
  },
});


when i try to hit the api with http://localhost:3000/api/auth/signup, the response shows 404
Was this page helpful?