Home > Net >  How to deploy next.js frontend and separated express backend
How to deploy next.js frontend and separated express backend

Time:03-29

I'm developing an app that contains next.js as a frontend and separated backend server running on express. I'm wondering about production deploy and costs, I did some research but I'm not sure what's the best way to do it.

My folder structure is following. I have separated packages.json on the frontend and separated on the backend. Two apps also run on different port. Also I'm doing SSR on the frontend.

enter image description here

CodePudding user response:

Next.js already includes a server like express. API Routes allow you to build a backend deployed along with the rest of the next application.

API Routes live in the /pages/api folder.

  • Related