Next.js Discord

Discord Forum

Why can I not call my server route (using app router)

Unanswered
Common carp posted this in #help-forum
Open in Discord
Avatar
Common carpOP
import { EmailTemplate } from "../../../components/email-template";
import { Resend } from "resend";

const resend = new Resend(process.env.RESEND_API_KEY);

export async function POST(req: Request) {
  const data = await req.json();

  console.log(data);

  const { email, name, vraag } = data;

  try {
    const data = await resend.emails.send({
      from: "Acme <noreply@resend.dev>",
      to: ["xxx"],
      subject: "xxxxx",
      react: EmailTemplate({ email, name, vraag }),
      text: `xxxxx`,
    });

    return Response.json(data);
  } catch (error) {
    return Response.json({ error });
  }
}

I am using a NextIntl middleware maybe that is blocking it from reaching the server.

I am calling /api/send
Image

0 Replies