1

Ideally NextJs code runs on a different port 3000. Can we have NextJS code clubbed in Springboot executable Jar /WAR (embedded Tomcat) which runs on default port 8080, and make the clubbed application jar/war run on single port?

Just want to highlight, React JS can be clubbed with Springboot , whereas NextJS I am no sure.

James Z
  • 12,209
  • 10
  • 24
  • 44

2 Answers2

0

Next.js is written in Javascript, Spring Boot is written in Java, they cannot be run together. However, after you run them in different ports, you can use a reverse proxy (e.g. Nginx) to stick them together under the same port but different endpoints (for example map Next.js to / and Spring Boot to /api)

0

Yes you can !

Check the answer over here:

How do I serve the NextJs application from spring boot application?

you need to modify the api link inside the nextjs (frontend) from http://xxxxx to /xxx,

Man Man Yu
  • 161
  • 3
  • 13