Skip to content

Commit

Permalink
Update README.MD
Browse files Browse the repository at this point in the history
  • Loading branch information
iway1 authored Jan 2, 2023
1 parent b777220 commit d84e425
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,24 @@ app.use("/panel", (_, res) => {

`trpc-panel` just renders as a string, so it can be used with any backend.

## NextJS / create-t3-app example
In Nextjs you'd want to create an api route somewhere like `src/pages/api/panel.ts` and send a text response:

```ts
import type { NextApiRequest, NextApiResponse } from "next";
import { renderTrpcPanel } from "trpc-panel";
import { appRouter } from "../../server/api/root";

export default async function handler(_: NextApiRequest, res: NextApiResponse) {
res.status(200).send(
renderTrpcPanel(appRouter, {
url: "http://localhost:3000/api/trpc",
transformer: "superjson",
})
);
}
```

## Documenting Procedures

As of v1.1.0, `trpc-panel` supports documenting procedures.
Expand Down

0 comments on commit d84e425

Please sign in to comment.