Saturday, 14 September 2019

node.js back end server and spring boot front end HTTP Connection

Hello all,I am developing a web application and have decided to use node.js and javascript for my backend and server logic. For the frontend I am using Spring boot and Java. This web app uses Restful services and is using mongodb hosted through mlab.At the moment I have the database setup and basic node server functionality that handles GET and POST requests for an object that I have defined. Using Postman I am able to succesfully POST new json objects and GET the json objects by id from my database through my node.js server logic, and serve the correct http json response which I am able to confirm from Postman.On the frontend, I have my REST API successfully POSTing and GETing objects from the mlab database aswell. However, the frontend is connected directly to the database through Spring boots standard RestController and Service/Repository project workflow (the http requests are not handled by my server logic). The frontend Spring boot tomcat server runs on port 8080. When I go to localhost8080 the front end works perfectly (the webpage shows all the correct data, and I can browse to my other pages where the correct data is served aswell).My backend server runs locally on port 3000. So my question is how do I connect these two separate applications so that my node.js server handles all the json requests from my spring boot frontend, and then serves the json response back to the frontend after it passes through my server logic?Any help or direction to the correct resource would be a much appreciated as I am kind of stuck on this. And sorry in advance if this isn't the proper sub to post this question.

Submitted September 15, 2019 at 05:32AM by campz95

No comments:

Post a Comment