Currently, I have to manually find which file(api endpoint) I to set breakpoint in /api folder in VSCode.
I have the following launch.json:
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "attach",
"name": "Attach to application",
"skipFiles": ["<node_internals>/**"],
"port": 9229
}
]
}
Is there a way to automatically stop or set breakpoint whenever there is an incoming request to that specific Nextjs Api Route?
For example, let's say I have an /api/data.tsx :
import { NextApiRequest, NextApiResponse } from 'next';
import { StatusCodes } from 'http-status-codes';
import getConfig from 'next/config';
export default async (req: NextApiRequest, res: NextApiResponse): Promise<void> => {
console.log('do some logging');
res.status(StatusCodes.OK).json({message: 'Good job buddy!'});
}
And want to stop on console.log on every incoming request. How can I do it?