added new api route

This commit is contained in:
2023-01-26 07:54:04 -06:00
parent 73fda90f01
commit cd8c3ce7e0
2 changed files with 12 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
import { createTRPCRouter } from "./trpc";
import { exampleRouter } from "./routers/example";
import { projectRouter } from "./routers/projects";
/**
* This is the primary router for your server.
@@ -7,7 +8,8 @@ import { exampleRouter } from "./routers/example";
* All routers added in /api/routers should be manually added here
*/
export const appRouter = createTRPCRouter({
example: exampleRouter,
example: exampleRouter,
projects: projectRouter,
});
// export type definition of API

View File

@@ -0,0 +1,9 @@
import { z } from "zod";
import { createTRPCRouter, publicProcedure, protectedProcedure } from "../trpc";
export const projectRouter = createTRPCRouter({
countCompletedVideos: publicProcedure.query(({ ctx }) => {
return ctx.prisma.example.findMany();
}),
});