Dinuma
Dinuma2y ago

Mutation in Convex through NextJS API Routes

Hello, I'm currently working on a NextJS Project where there are multiple riddles where the user will submit their answers. I'm currently evaluating them on the server-side through NextJS 13 API Routes (Route Handlers). I was wondering how I would create a mutation from NextJS 13 API Routes into Convex to update my DB. I'm majorly relying on convex real-time for a scoreboard (high-read throughput), but I need the writes to simply just be over HTTP, as I currently validate them through existing NextJS API Routes. Attached a flow chart of my problem, would love recommendation(s) / resource(s).
No description
5 Replies
ballingt
ballingt2y ago
It sounds like you want to use the ConvexHttpClient in Next.js to call some mutations.
Dinuma
DinumaOP2y ago
Thank you! This worked out great!
Coffee11
Coffee119mo ago
Dinuma can you share how did you make it work?
Michal Srb
Michal Srb9mo ago
Next.js Server Rendering | Convex Developer Hub
Next.js automatically renders both Client and Server Components on the server
Coffee11
Coffee119mo ago
Git it working now thanks !

Did you find this page helpful?