add nextjs and migrated api to next api

This commit is contained in:
Carl-Gerhard Lindesvärd
2023-10-12 23:19:02 +02:00
parent 7d474e8444
commit cef7fc6965
47 changed files with 1466 additions and 1 deletions

View File

@@ -0,0 +1,25 @@
import { z } from "zod";
import {
createTRPCRouter,
protectedProcedure,
publicProcedure,
} from "@/server/api/trpc";
export const exampleRouter = createTRPCRouter({
hello: publicProcedure
.input(z.object({ text: z.string() }))
.query(({ input }) => {
return {
greeting: `Hello ${input.text}`,
};
}),
getAll: publicProcedure.query(({ ctx }) => {
return ctx.db.example.findMany();
}),
getSecretMessage: protectedProcedure.query(() => {
return "you can now see this secret message!";
}),
});