mxcdh
mxcdh

Reputation: 1151

T3 - Importing router from `../trpc`

I am using t3-oss https://github.com/t3-oss. In latest version of t3, when I want to create a new router and want to import {router} from trpc, I have error:

import { router, publicProcedure, protectedProcedure } from "../trpc";

Module '"../trpc"' has no exported member 'router'.ts(2305)

I checked the trpc documentation, and {router} should include the `trpc.ts' file. -> https://trpc.io/docs/router

What should I do? When is router in T3?

This is my trpc.ts https://pastebin.com/g3Y0iP14

Upvotes: 0

Views: 265

Answers (1)

Christopher Ehrlich
Christopher Ehrlich

Reputation: 383

In the template generated by Create T3 App, all of the tRPC related stuff is exported from ./src/server/api/trpc.ts. You can look in ./src/server/api/routers/example.ts for an example of all the imports you'll need.

The specific thing you're looking for is called createTRPCRouter.

Upvotes: 1

Related Questions