import { NextRequest, NextResponse } from "next/server";
import SuperTokens from "supertokens-node";
import { backendConfig } from "@/lib/supertokens/backendConfig";
import { getAppDirRequestHandler } from "supertokens-node/nextjs";

SuperTokens.init(backendConfig());

const handleRequest = getAppDirRequestHandler(NextResponse);

export async function GET(request: NextRequest) {
  const response = await handleRequest(request);
  return response;
}

export async function POST(request: NextRequest) {
  const response = await handleRequest(request);
  return response;
}

export async function DELETE(request: NextRequest) {
  const response = await handleRequest(request);
  return response;
}

export async function PUT(request: NextRequest) {
  const response = await handleRequest(request);
  return response;
}

export async function PATCH(request: NextRequest) {
  const response = await handleRequest(request);
  return response;
}

export async function HEAD(request: NextRequest) {
  const response = await handleRequest(request);
  return response;
}
