Is it possible to enable database connection using NodeJS within react app and deploy bundled file in server?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Is it possible to enable database connection using NodeJS within react app and deploy bundled file in server?



Here is my situation



I have a React app which uses Webpack to bundle all modules. Now I want to get data from database and show it in the App.



I understand we can develop node/Java backend service which will run on different port and access it from React app either using fetch/ajax but I don’t want backend service to run on different port.



I want to enable database connection within React app and get data from DB in the component. So, can I establish a database connection to get data from database within React app and bundle this node code in Webpack bundle.js? Will I be able to get data from database when this bundled file deployed in server? Eg. tomcat



Please suggest possible solution




1 Answer
1



No, you wont, that's all because react is used in the front end.



However, you should check out React Server Side Rendering (SSR). That will definitely accomplish your task





Next.js is a nice framework for SSR!
– Tico
Aug 12 at 4:38





Ok. If I have server side react in my node service. Can that be deployed in tomcat?
– Think-Twice
Aug 12 at 6:13






The problem which I am facing right now is I have my backend service in node js and front end in ReactJS and both has to be deployed only in tomcat server.
– Think-Twice
Aug 12 at 6:16






@tico next.js is a Cisco framework for topology view right? Can you please let me know how that will help in my case.
– Think-Twice
Aug 12 at 6:21





@HemadriDasari No, maybe you're confusing it. Please check the link in the original post -- Straight from the GitHub repo: Next.js is a minimalistic framework for server-rendered React applications.
– Tico
Aug 12 at 8:11






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

Creating a leaderboard in HTML/JS