My project using next13, kotlin spring. I want to upload image.(I only use nextjs, there is other backend developer who use kotlin spring)
Way I think.
A. Just request rest api to spring server directly from the client (‘use client’ component) ex)When put the image to input type file, just do axios post to spring server api.(like normal way we did when we use react)
B. Request api to next server(app/api/blahblah) and then request again to spring server.
If A is good way.. what is next server for? Is Using nextjs only good for full stack developer..who work alone? (To be honest, I don't quite understand what role next server plays when working in a company where the backend and frontend collaborate)
If B is good way.. Could you please explain how it works? I guess axios/fetch post to next server and get the req data, and then axios/fetch post again from the next server to backend server(spring server in my case). Am I right??
Sending the request from the frontend directly to the backend would be the right choice. Although nextjs can be used to create full-stack applications, it can also be used to develop front-end applications.