Next.js Discord

Discord Forum

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

Common carp posted this in #help-forum
Open in Discord
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();


  const { email, name, vraag } = data;

  try {
    const data = await resend.emails.send({
      from: "Acme <>",
      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

0 Replies