Igor_lviv
Igor_lviv
TtRPC
Created by Igor_lviv on 5/10/2023 in #❓-help
How to upload file not use S3 Next js? Please, example
file: course.router.ts / import { CourseSchema } from "~/schema/post.schema"; import { createTRPCRouter, publicProcedure, protectedProcedure, } from "~/server/api/trpc"; import formidable from "formidable"; import fs from "npm"; export const courseRouter = createTRPCRouter({ create: protectedProcedure.input(CourseSchema).mutation(({ ctx, input }) => { //upload and save here input.file //// // throw new TRPCError({ code: "INTERNAL_SERVER_ERROR" }); return ctx.prisma.curse.create({ data: { name: input.name, video: input.video, descriptionCurse: input.descriptionCurse, }, }); }), });
4 replies