From 9fdd7311368411d59784977f77d1af103ae16543 Mon Sep 17 00:00:00 2001 From: zyachel Date: Mon, 30 Oct 2023 01:25:32 +0530 Subject: [PATCH] feat(api): add a catch-all route --- src/pages/api/[...error].ts | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 src/pages/api/[...error].ts diff --git a/src/pages/api/[...error].ts b/src/pages/api/[...error].ts new file mode 100644 index 0000000..cbc00f6 --- /dev/null +++ b/src/pages/api/[...error].ts @@ -0,0 +1,7 @@ +import type { NextApiRequest, NextApiResponse } from 'next'; + +type ResponseData = { status: false; message: string }; + +export default async function handler(_: NextApiRequest, res: NextApiResponse) { + res.status(400).json({ status: false, message: 'Not found' }); +}