Skip to content

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

Open
itelo wants to merge 1 commit into
iway1:mainfrom
itelo:app-router-example
Open

feat: add app router example on readme.md#88
itelo wants to merge 1 commit into
iway1:mainfrom
itelo:app-router-example

Conversation

@itelo

@itelo itelo commented Aug 15, 2023

Copy link
Copy Markdown

No description provided.

@tomassabol

Copy link
Copy Markdown

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

itelo commented Aug 16, 2023

Copy link
Copy Markdown
Author

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
Copy Markdown

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

@joshy36

joshy36 commented Sep 20, 2023

Copy link
Copy Markdown

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

@tomassabol

Copy link
Copy Markdown

@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

joshy36 commented Sep 20, 2023

Copy link
Copy Markdown

ok thanks for letting me know

@joshy36

joshy36 commented Sep 20, 2023

Copy link
Copy Markdown

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