T
TanStack10mo ago
optimistic-gold

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);
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",
},
});
},
});
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
1 Reply
optimistic-gold
optimistic-gold10mo ago
please post in #start-questions

Did you find this page helpful?