mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-26 23:58:31 -06:00
moving to trpc
This commit is contained in:
23
nextjs/src/services/trpc/router/app.ts
Normal file
23
nextjs/src/services/trpc/router/app.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { createContext } from "../context";
|
||||
import publicProcedure from "../procedures/public";
|
||||
import { createCallerFactory, mergeRouters, router } from "../trpc";
|
||||
|
||||
export const helloRouter = router({
|
||||
sayHello: publicProcedure.query(() => {
|
||||
// runs on the server I think
|
||||
console.log("hello world router on the server?");
|
||||
return { greeting: `Hello World!` };
|
||||
}),
|
||||
});
|
||||
|
||||
|
||||
export const appRouter = mergeRouters(helloRouter);
|
||||
|
||||
export const createCaller = createCallerFactory(appRouter);
|
||||
|
||||
export const createAsyncCaller = async () => {
|
||||
const context = await createContext();
|
||||
return createCaller(context);
|
||||
};
|
||||
|
||||
export type AppRouter = typeof appRouter;
|
||||
Reference in New Issue
Block a user