Connect to remote Realm with nodeJS for server side and Angular for client side, good practice? - node.js

I'm currently trying to figure out which technologies to use in order to maintain "realm features" in a web browser application. I've put together a rudimentary Swift app on iOS which allows for real-time updates coming from realm cloud.
I've spent the last 3-4 hours reading about Nginx, nodeJS, Angular, Express (angular framework) and other technologies.
As far as I've been able to understand, Realm can work with GraphQL which in turn lists nodeJS as a dependency (https://docs.realm.io/sync/getting-started-1/web-based-graphql).
So far I have a Debian 10 server running nginx. I have also installed nodeJS and NPM.
Assuming that I'm on the right path, where do I go from here?
It's proving to be a pretty tough challenge for me but, any help is greatly appreciated!
Thank you for your time.
Regards,
Renato

Related

How can I create a MERN Stack application?

Ok, so my question is actually a bit more complex.
I know how to develop Node.js apps using Express.js. I also know how to build React apps. The problem is putting it together. I've seen many tutorials do it, but they just use the Express backend as if it was an API.
I don't know if this is the best option, but I'd like to have my Node app, and then in the frontend add React. The main difference is that when it comes to handling the URLs, it will be Node who would do it. Therefore, if Node is on port 3000, you would have to go to localhost:3000 to access the website, opposite the guides I've found online.
I would really appreciate some help, as well as other resources as documentation or videos online.
NextJS seems to be a good approach for your situation.
It binds a Nodejs backend with a react frontend with an intuitive developer experience.
It has middleware, handles server-side rendering, code splitting, and routing for you. It also provides a development server that allows you to run your application on a specific port (e.g. 3000) and handle the routing on the server side.
You can serve the react build folder from your node server.
Check this link

how to deploy an ionic-react app to mobile if I'm using node js server in the backend?

I discovered ionic this week and I'm really considering using it at work.
Basically, my goal is to build an app that will work on android and Ios, where the needed functionality is to connect to the cloud over web socket and pull data from the cloud and show it on my phone. Maybe later I'll eventually need to consider using login but not for now at least.
Normally, if I'm building a web app. I ll use nodejs to pull the data from the cloud and expose it to the frontend. I ll write all code together and I ll host my app in Heroku or something where the entry point is my nodejs server right? So that my server needs to start and it will take care of the rest.
This is a bit confusing in ionic since I need to start the app with ionic serve, but somehow I also need to start my nodejs server too right? So I assume I can't write the server-side code inside the ionic app or am I wrong?
There is not much about this on the internet but I did some research and I guess that I should deploy (host) my nodejs server in the cloud (maybe using Heroku) and then connect to the server from my mobile app over the socket. Is this the right/only way to do this? are there any security issues with this method?
I find ionic great but I'm not sure if I should use it at work. Sincerely, this use case of using a backend server with ionic made me confused.
Ionic looks ideal for building cross-platform apps that does not need server-side scripting, but how complex can it be if I want to integrate some server-side code in my app? especially as I said I'm going to use some login forms in the future to extend the functionality of my app.
PS: I'm using ionic 6.10.1 and specifically I'm interested in using ionic with react not with angular.
After some search, I discovered that it isn't possible to deploy the frontend and backend code together. Therefore the trick is to deploy the nodejs server separate from the frontend.
Precisely, if it is a web app, then you should deploy the nodejs server in a separate host from the frontend. Then by starting the frontend app, you can communicate with the running nodejs server via socket or REST API.
Hope this helps someone in the future :)

What are the steps to Host a REACT App which is using ExpressJS for back-end operations?

I have developed an application which is using REACT for front end and ExpressJS(framework for nodejs) for back-end. Code is running properly in my local machine.
I have no idea about hosting this application so that other people can use it.
Note: Both REACT project and Node project must be running parallel to make this application work
Appreciate your help !!
You can use this one https://www.heroku.com
It's a popular platform. It's free for a limited amount of space, so it's good to try out applications. It's pretty easy to use, you can even auto-deploy your app every time you push it to github repo, if you have one.

Lumen (Laravel) V.S NODE.JS Solutions

i need to develop an API backend that it should be :
robust
high performance
provides RESTFULL API
connected to a Mysql storage: i prefer a relation db for the
complexity
only backend not also frontend framework
I'm undecided between :
Lumen : i need only API service because i choose react js as frontend framework.. so i think is better lumen than laravel because i no need frontend
Nodejs api solution: In this moment searching on the web i found Seals and Loopback as framework for my api backend.
I find discortanti opinions ... some told that php solution as Lumen is not good for performance ( see http://www.infoworld.com/article/2866712/php/php-vs-node-js-an-epic-battle-for-developer-mind-share.html ).... and some one told that in this moment there arent reliable api backend framework in node js: seals is not good for performance and about loopback i found few comment... so i ask you what is the best choiche for performance and robust solution ..
I'd recommend Loopback. It has been acquired by IBM so you can expect continued improvement and stability.
If you think about JavaScript for client and server side then you can choose node.js with sails.js framework which is follow full MVC structure. If you use sails.js, you don't need to be expert in node.js. It's easy like other PHP framework like Laravel. For database you can use MongoDB. To work with different types of API include angular.js also. So finally your platform dependencies are:
1. Node.js (Server Side Coding)
2. Sails.js (For Maintain MVC Structure)
3. Angular.js (For Managing Frontend, HTTP request API etc)
4. MongoDB (For Database)
So that you will find out everything require your working development dependency. I think this will help for you.
Thank You :)

Integrate Node with Phonegap app

I want to develop an hybrid cross platform app that creates a socket connection to given Ip.
I have achieved it using webTCP module in node.js by running node from cmd to start the server.
Now I want to pack this in to an app using Phonegap. But my question is how do I run node(to start server) in mobile through the app created using phonegap.
Do we need to install node in mobile. If so how can I do that?
Thanx in advance.
nodejs isn't done (yet) to run on Android. NodeJs is a server thing so it should run on your server to run tour backend.
In order to do what you want to do you will have to redesign your architecture.
Indeed, Cordova/PhoneGap is a little server (actually it's is a WebView but you can approximate it to a static content delevery server). So you will have to made your cordova app talk to your node-server.
1. CORS
Cordova-app <- INTERNET -> Node-server
The first thing to do is to enable CORS, for nodejs and whitelist the adress of your node-server in cordova
2. let's talk
Now you can start talking to your server with your cordova app, there is many ways to do that :
xhr/Ajax request
Pur WebSocket (you will need to enable JAVA-WebSocket)
Socketio
3. being more powerful
You will need more powerful feature between your app and your server side. In order to do that, you could need some WebApp framework. Indeed, they automate for you the connection between the server and your application and offer you a cool and easy environment to do great apps. If you want to know more about it, you could look at
BackBone
Marionette
AngularJs
Hope that help.

Resources