+ 3
How to connect frontend and backend?
How front and backend communicate with each other? Considering I have REST API on Java Spring and frontend on JS.
11 odpowiedzi
+ 5
You map the Controller to an URL and fetch from that URL.
In Spring:
Annotate @RestController
and some (sub)annotation of @RequestMapping(value="myUrl") define the method (put, get, whatever).
Alternatively, you can annotate with the dedicated subannotations: @PutRequest etc.
On the frontend you can use the fetch method.
That's all, basically.
+ 2
Yeah, so many possibilities ;)
Decision making can be hard. Maybe it's best if you read some how-tos of different providers and try to make a decision afterwards.
+ 1
In production there will be jar or war file for backend. What will be for frontend - HTML, JS, css? Should front be running on different port/server?
+ 1
The frontend will be a website with html, css, js as you mentioned created with or without frameworks like angular, vue, react, whatever you prefer.
You can run frontend/backend on different ports for development but if you want to publish your website it's probably best to work with subdomains for frontend and backend. You'll find configuration instructions on your webhoster / provider websites.
+ 1
Geoffrey L
Sorry for the late reply, I'm just back from vacation ^^
From what I understand nginx correpsonds to the 'A' of the lamp environment, the web server. There are many other environments / predefined configs you can use to achieve the same, xampp is one I work with at home.
Many providers advertise supporting nginx or other server solutions, as mentioned before it's hard to recommend one particular solution for me at least.
+ 1
Tashi N no worry, hope you had good holidays :)
I just see nginx popup everywhere in tutorials. I don't see why use nginx when a traditional LAMP is working as a charm. So for the moment I stay with the old school version :D
0
Here are a few threads that I found but lets include this from stackoverflow here
https://stackoverflow.com/questions/50671420/how-do-you-connect-java-backend-with-html-css-frontend
https://www.sololearn.com/discuss/1127638/?ref=app
0
How to achieve that? With NGIX?
0
Yeah, nginx or other :)
0
Sorry too many silly questions in my head just trying to put the puzzle together
0
Tashi N Ilja Veselov Based on this topic, which I was looking for, I would like to know what is the purpose of nginx ?
Isn't the same to build a lamp environment to run a website ?
Or they are totally differents technologies ?