Get IP Address in tRPC router

Hey guys how can I get the IP address inside a procedure?

Like this code f.ex:
export const contactRouter = createTRPCRouter({
  hello: publicProcedure
    .input(contactSchema)
    .mutation(async ({ input, ctx }) => {
      // get ip here
      const msg = await db.contactMessage.create({
        data: {
          name: input.name,
          email: input.email,
          subject: input.subject,
          message: input.message,
        },
      });
      return { success: true, msg };
    }),
});
Was this page helpful?