简体   繁体   中英

Console.log to debug code in nextjs API routes?

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, 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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM