I'm developing the NextJS app with express, postgresql, is it good approach to put the API endpoints in the next.js pages/api folder? Or should it be separated?
I thought about separating it to client/server folders, but I don't know how to share the cookies between 2 ports on localhost (I want to use httpOnly cookie for authentication), because my server was running on 3030, and nextjs app on 3000, so I thought that maybe I should keep everyting in next.js and create endpoints in pages/api.
Which one is the better solution?