learnix / src /app /api /subscriber /route.js
shashidharak99's picture
Upload files
7d51e81 verified
import { NextResponse } from "next/server";
import { connectDB } from "@/lib/db";
import Subscriber from "@/models/Subscriber";
export async function GET(req) {
try {
await connectDB();
const res = await Subscriber.find();
return NextResponse.json(res, { status: 201 });
} catch (error) {
return NextResponse.json({ error: "error" }, { status: 400 });
}
};