-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(pages/integrations): add mention about transformer usage
- Loading branch information
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,56 @@ import { Callout, Steps, Tabs } from 'nextra-theme-docs'; | |
|
||
# Integrations | ||
|
||
### Data Transformers | ||
You are able to serialize the response data & input args. Right now the only supported transformer is `superjson`. | ||
|
||
You need to use `superjson` version `1.13.3` because version `^2.0.0` doesn't support commonjs. | ||
|
||
To use `superjson`, you can install it using your preferred package manager: | ||
|
||
<Tabs items={['npm', 'pnpm', 'yarn', 'bun']}> | ||
<Tabs.Tab> | ||
```bash copy | ||
npm install [email protected] | ||
``` | ||
</Tabs.Tab> | ||
<Tabs.Tab> | ||
```bash copy | ||
pnpm add [email protected] | ||
``` | ||
</Tabs.Tab> | ||
<Tabs.Tab> | ||
```bash copy | ||
yarn add [email protected] | ||
``` | ||
</Tabs.Tab> | ||
<Tabs.Tab> | ||
```bash copy | ||
bun install [email protected] | ||
``` | ||
</Tabs.Tab> | ||
</Tabs> | ||
|
||
And then you can use it in your `TRPCModule` options: | ||
|
||
```typescript filename="app.module.ts" copy | ||
import { Module } from '@nestjs/common'; | ||
import { TRPCModule } from 'nestjs-trpc'; | ||
import { superjson } from 'superjson'; | ||
|
||
@Module({ | ||
imports: [ | ||
TRPCModule.forRoot({ | ||
autoSchemaFile: './src/@generated', | ||
transformer: superjson, | ||
}), | ||
], | ||
}) | ||
export class AppModule {} | ||
``` | ||
|
||
|
||
|
||
### Accessing the AppRouter | ||
In some circumstances ,for example end-to-end tests or integrating with other `trpc` plugins, you may want to get a reference to the generated appRouter object. In end-to-end tests, you can then run queries using the appRouter object directly without using any HTTP listeners. | ||
|
||
|