added new api route
This commit is contained in:
@@ -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
|
||||
|
||||
9
src/server/api/routers/projects.ts
Normal file
9
src/server/api/routers/projects.ts
Normal 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();
|
||||
}),
|
||||
});
|
||||
Reference in New Issue
Block a user