How To Internally Communication Between Vue.js Front End And Node.js+MYSQL Backend
I am new to node.js and running web app on EC2 ubuntu, right now, my team have complete vue.js front end project, and I have complete node.js express + MYSQL backend, and I have tested the connection and set up of server-side API (node.js + MYSQL) by pulling from our git back-end branch. The front end has already been tested locally by listening to public IP address. while hosting server-side on EC2, now it is time to upload the front-end project (which is in the front-end branch) on EC2 to host the front end project. and now I have 2 problems:
should we merge back-end and front-end branches together to the main? and then clone main? I have already cloned our project but in back-end branch on git. would that conflict?
If running both projects on EC2 ubuntu, should API listening on PORT above 4000 (which is I believe not publicly accessible?) like 8080? should it listen to localhost or public IP address?
This is my first SE project with my team. We have researched so many online resources but we still get lost, thank you so much!
- should we merge back-end and front-end branches together to the main? and then clone main? I have already cloned our project but in back-end branch on git. would that conflict?
Why would you want to do any of that? Git just organizes your code, it doesn't dictate how the code is deployed.
- If running both projects on EC2 ubuntu, should API listening on PORT above 4000 (which is I believe not publicly accessible?) like 8080?
By default, no ports on AWS are public at all. You have to open the ports you want to open in the EC2 security group. Running the backend on port 8080 would be fine, if you open that port on the security group.
should it listen to localhost or public IP address?
The Vue application runs in every user's web browser, so it can't listen to
localhost. The public IP on AWS is NATed, so it probably can't listen to that either. Generally this type of service would listen to
Note that none of this so far is secure, for example there is no SSL so all communication between the front-end and back-end is in the open. None of this is fault tolerant, your single server goes down your entire system is down. None of this is scaleable, if you start getting a lot of traffic you have no way of adding more servers to handle the load.
I suggest looking into using AWS Elastic Beanstalk to deploy your application for you. It will give you ways to easily add load balancing, auto-scaling, and an SSL certificate.
- → Maximum call stack exceeded when instantiating class inside of a module
- → Browserify api: how to pass advanced option to script
- → Node.js Passing object from server.js to external modules?
- → gulp-rename makes copies, but does not replace
- → requiring RX.js in node.js
- → Remove an ObjectId from an array of objectId
- → Can not connect to Redis
- → React: How to publish page on server using React-starter-kit
- → Express - better pattern for passing data between middleware functions
- → Can't get plotly + node.js to stream data coming through POST requests
- → IsGenerator implementation
- → Async/Await not waiting
- → (Socket.io on nodejs) Updating div with mysql data stops without showing error