简体   繁体   中英

How to use Next.js with spring-boot as back-end server?

How can I setup a project using Next.js and springboot. I tried to read next.js documentations, all of them point to other backend technologies, none of them showing springboot setup. If someone can guide me, or provide me some documentation of how to use those both frameworks in one project, it will be of a great help.

Developing with springboot or react, I am fine with them, I don't have any difficult.

Springboot is another backend server that stand alone outside NextJS project. The way to make it works between NextJS project and springboot is by serving springboot as a RESTful API, then you call springboot's API from NextJS.

I never touch springboot before, but here is the reference how to serve springboot as a backend API: https://dzone.com/articles/ext-js-4-spring-mvc-crud .

And this is one example of how do you fetch data from front-end using NextJS: https://github.com/zeit/next.js/blob/canary/examples/data-fetch/pages/index.js .

There are many method on how do you fetch data from front-end, some of the options include these npm dependencies:

  1. HTTP - Standard Library
  2. Request
  3. Axios
  4. SuperAgent
  5. Got

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