Skip to content

Commit

Permalink
feat: ✨ Adição da rota cron e do vercel.json
Browse files Browse the repository at this point in the history
  • Loading branch information
welllucky committed Dec 8, 2023
1 parent 1e9ba07 commit 808ecfb
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/app/api/cron/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { NextRequest, NextResponse } from "next/server";

export async function GET(request: NextRequest) {
const authHeader = request.headers.get("authorization");
if (authHeader !== `Bearer ${process.env.CRON_SECRET}`) {
return NextResponse.json("Unauthorized", {
status: 401,
});
}

return (
NextResponse.json({ success: true }),
{
headers: {
"Content-Type": "application/json",
},
}
);
}

0 comments on commit 808ecfb

Please sign in to comment.