import type { NextApiRequest, NextApiResponse } from "next"; import config from "@/config"; export default function handler(req: NextApiRequest, res: NextApiResponse) { if (req.method === "POST") { if (req.headers.token !== config.token) { console.log("api::config: wrong token", req.headers.token, config.token); res.status(403).json({ error: "wrong token" }); return; } // update config config.begin = req.body.begin ?? config.begin; config.limit = req.body.limit ?? config.limit; console.log("api::config: update config", config); } res.status(200).json(config); }