21 lines
513 B
TypeScript
21 lines
513 B
TypeScript
import type { NextApiRequest, NextApiResponse } from "next";
|
|
|
|
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
|
|
const apiKey = req.headers.authorization || req.query.apiKey;
|
|
if (process.env.CRON_API_KEY !== apiKey) {
|
|
res.status(401).json({ message: "Not authenticated" });
|
|
return;
|
|
}
|
|
if (req.method !== "POST") {
|
|
res.status(405).json({ message: "Invalid method" });
|
|
return;
|
|
}
|
|
|
|
/**
|
|
* TODO:
|
|
* Remove this endpoint
|
|
*/
|
|
|
|
res.json({ ok: true });
|
|
}
|