cal/packages/trpc/server/routers/_app.ts
Alex / KATT 2f8bd3c07a
add trpc v10 (#4683)
* revert me later

* let's see if this builds

* fix dupe proc

* fix: v10 works

* fix type error

* fix type error

* fix type errors

* fix more

* add example procedure

* spreading not needed

* Update yarn.lock

* Revert "revert me later"

This reverts commit 0c8c15d057.

Co-authored-by: Chris Bautista <chrisbautista@netflix.com>
Co-authored-by: Peer Richelsen <peeroke@gmail.com>
Co-authored-by: Omar López <zomars@me.com>
Co-authored-by: Alex van Andel <me@alexvanandel.com>
2022-09-29 16:58:29 +00:00

33 lines
895 B
TypeScript

/**
* This file contains the root router of your tRPC-backend
*/
import { createRouter } from "../createRouter";
import { publicProcedure, t } from "../trpc";
import { publicRouter } from "./public";
import { viewerRouter } from "./viewer";
/**
* Create your application's root router
* If you want to use SSG, you need export this
* @link https://trpc.io/docs/ssg
* @link https://trpc.io/docs/router
* @deprecated
*/
export const legacyRouter = createRouter()
/**
* Optionally do custom error (type safe!) formatting
* @link https://trpc.io/docs/error-formatting
*/
// .formatError(({ shape, error }) => { })
.merge("viewer.", viewerRouter)
.interop();
const v10Router = t.router({
hello: publicProcedure.query(() => "hello"),
public: publicRouter,
});
export const appRouter = t.mergeRouters(legacyRouter, v10Router);
export type AppRouter = typeof appRouter;