Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add app router example on readme.md #88

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

itelo
Copy link

@itelo itelo commented Aug 15, 2023

No description provided.

@tomassabol
Copy link

Hi, I tried searching for issues related to app router and found this one. I tried the solution suggested in your commit, but it did not work. Luckily, I managed to get it working using this:

import { renderTrpcPanel } from "trpc-panel";
import { appRouter } from "~/server/routers/_app";

const panelHandler = () => {
  return new Response(
    renderTrpcPanel(appRouter, {
      url: "http://localhost:3000/api/trpc",
      transformer: "superjson",
    }),
    {
      headers: { "Content-Type": "text/html" },
    }
  );
};

export { panelHandler as GET, panelHandler as POST };

Location of the file is the same as you used, src/app/api/panel/route.ts

Hope this helps

@itelo
Copy link
Author

itelo commented Aug 16, 2023

Hey @tomassabol, the only change was on the appRouter import? I believe it's okay not to be 100% accurate because the appRouter location could change depending on where the user puts it.

@tomassabol
Copy link

Yes, the import is individual. The main thing I changed is the export, and export types.

@joshy36
Copy link

joshy36 commented Sep 20, 2023

@itelo @tomassabol anyone get {"name":"TRPCClientError"} error when trying to make a query or mutation?

@tomassabol
Copy link

@itelo @tomassabol anyone get {"name":"TRPCClientError"} error when trying to make a query or mutation?

Unfortunately yes. I am getting this error on every endpoint using this implementation, but when I tried using this experimental repo, it worked flawlessly

@joshy36
Copy link

joshy36 commented Sep 20, 2023

ok thanks for letting me know

@joshy36
Copy link

joshy36 commented Sep 20, 2023

Im probably gonna just wait until they support the app router lol and keep using the first implementation for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants