Using Express and Spring boot dual backend for Single react Project - reactjs

I have a react frontend project and I am using mongo DB as my database. I want to implement rest api with both spring boot and express JS. It means some of the api calls should done by spring boot and others should done by express js. Is there any option to do this?

I don't see why not. You will have two separate servers running - one NodeJS + ExpressJS, and the other would be Spring Boot. Your client does not need to know what the implementation of these servers are (i.e. Spring Boot, ExpressJS, Java, Python, whatever). The client will just need the URL of the endpoint that is being served by your servers.
This is the beauty of REST - de-coupled client and server.

Related

How to host a Spring Boot Application (backend) and React Application (frontend) on AWS?

I am a beginner in AWS and want to host a website whose backend is on Spring on frontend on React. I think we have to do it by using EC2 instances, my senior mentioned it. Any help at all is appreciated.
Right now in my react application, the data submitted by the user is being sent to localhost:8080 where my spring boot application is hosted. I think I'll have to host these 2 applications separately and follow the same procedure.
Take a look at the workshop for Web application Development with AWS Elastic Beanstalk. You will learn how to deploy a React frontend and a Node.js backend. Since you want to use Spring Boot for your backend, adapt that part of the workshop by applying what you learn in this step-by-step guide Deploying a Spring Boot Application on AWS Using AWS Elastic Beanstalk.
Here is an AWS tutorial that walks you through this use case. The Front end is a React App that sends requests to a Spring Rest Backend that returns JSON.
https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/javav2/usecases/Creating_Spring_RDS_%20Rest
The React app displays the data. I have successfully deployed the Spring backend on Elastic Beanstalk -- as shown here:
To learn how to deploy a Spring App on Elastic Beanstalk, see the section titled Deploy the application to Elastic Beanstalk in this tutorial.
https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/javav2/usecases/creating_first_project
All of the information you need to get this use case working is in these 2 articles.

Host Django and React on the same server?

I am working on a SAS product. So there could be 1000 users using my application at the same time.
Technologies Used:
Django for Backend
React.js for frontend
Django Rest Framework for APIs
I have hosted this project on a server with customized Nginx settings as shown here: https://stackoverflow.com/a/60706686/6476015
For now, I am having no issues but I want to know if there is some possibility of something going wrong in the future as usage and data will increase. Should I host the frontend and backend on separate servers?

Microservices architecture tutorial for springboot and react in production

My project contains two apps. Backend – springboot and a frontend - React.
I am using the spring-boot app only as a rest API to fetch data from the database. The React app frontend will call the API. Up until now, we were using only one environment (Windows) so production build was one jar that actually contains both apps and a tomcat. That was quite simple so by adding a proxy in the package.json file to point to the backend and some maven(frontend-maven-plugin) plugin the building process is simple.
Now we need to change the system architecture so each app will be hosts on a different windows machine.
I was trying to use express to host the react app but I am struggling with the proxy setup for the backend (spring) app from the express server. All the tutorials that I found actually using the express server as the backend API but I need the express server only for hosting the production build.
Is there a good tutorial that shows how to set up this type of architecture in production env.
Thank you

Connecting project in Monaca Mobile restful api backend with mysql database

Connecting project in Monaca Mobile restful api backend with mysql database
I have a backend developed with php and mysql with various restful apis consultation, inclusion, exclusion ready. I need to connect the mobile project in Monaca this backend by apis from our server.
I'm trying different codes using angular, but nothing has certain data. If I can not make this connection will give up working with monaca.
Thank you!
Could not find a working rest example. This example connects to remote server and pulls data from a remote server. Changing URL should take care of the rest.
https://github.com/argelius/onsen-weather-sample

Have a Django backend on server. What steps do I need to take to move my Angular frontend there as well?

I have a Django backend on a Linux server with AWS. It is running with the built in Django web server.
I have also built a simple AngularJS frontend on my local machine. I created a simple AngularJS frontend from scratch. The solutions can't communicate because they are on different servers.
I would like to move my AngularJS solution to the same server. What steps do I need to take to move AngularJS to the same server and to get AngularJS and Django to communicate?
The builtin Django web server ran with the command python manage.py runserver runs the Django backend locally so only local clients (with IP 127.0.0.1) can access it.
To make it publicly available you need to run it with the command python manage.py runserver 0.0.0.0:8000 it allows Django backend to be accessed on the network, on the port 8000. Also make sure you have opened the port. test this to see if you see any django views (assuming your server's IP is x.x.x.x use the address x.x.x.x:8000 in the browser).
I don't know if there already is an API implemented on your backend or not. I recommend django-rest-framework http://www.django-rest-framework.org
Now you have the API implemented by django-rest-framework and your Django backend is publicly available so you can communicate with it using Angular and Rest API with your server's public IP.
PS: If you wanted to put your frontend files on Django's static files directory you can follow the following documentation
https://docs.djangoproject.com/en/1.8/howto/static-files/

Resources