Home > Software design >  Equivalent of console.log to debug code in NextJS API routes?
Equivalent of console.log to debug code in NextJS API routes?

Time:12-25

I'm using nextjs API routes in my next app, and I have some code that runs when I send a POST request.

If the code that runs in the API route has errors or doesn't work right, I can't debug it because I can't use something like console.log to see what's happening because it won't log to the frontend page. Is there some alternative?

Maybe it would be in the network tab or involve throwing errors or sending something, I'm not sure.

CodePudding user response:

NextJS's server will log to the terminal that's running npm run dev this isn't within the browser.

Try look there and see if it shows.

  • Related