You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
642 B
TypeScript
24 lines
642 B
TypeScript
import { router, publicProcedure } from "../trpc/server";
|
|
import { todos } from "../database/todoItems";
|
|
import { chat } from "../pages/chat/trpc";
|
|
|
|
export const appRouter = router({
|
|
demo: publicProcedure.query(async () => {
|
|
return { demo: true };
|
|
}),
|
|
onNewTodo: publicProcedure
|
|
.input((value): string => {
|
|
if (typeof value === "string") {
|
|
return value;
|
|
}
|
|
throw new Error("Input is not a string");
|
|
})
|
|
.mutation(async (opts) => {
|
|
console.log("Received new todo", { text: opts.input });
|
|
todos.push({ text: opts.input });
|
|
}),
|
|
chat,
|
|
});
|
|
|
|
export type AppRouter = typeof appRouter;
|