Is using node.js is suitable for web GUI app and using same source for desktop app? - node.js

Im thinking about using node.js for web application , that is something like tomcat with servlents or Apache and php.
my questions are basic but fundamental:
1. can i use node.js as web server? using jquery and all the server side stuff?
2. i want to let the users to be able to use the application in offline mode , and let
the user to download the web app as desktop app .
can node.js be good for this job ?

Node.js is a platform for creating server-side and networking applications. You can use its HTTP and Socket support to create a web server.
And yes, you can use client side libraries and frameworks like jQuery, Angular.js, Ember.js, etc etc. by using a Node.js REST API as backend (as a possible solution).
You can make desktop applications using:
Node-QT bindings
Appjs

Related

Electron like node integration in nodejs web server

I'm new to web servers in nodejs and i'd like to know if there is possible to have an electron like node integration in a web server (to be able to use nodejs in index.js script file linked to index.html)
Thx for all :)
It's not possible. Browsers control the way that client side JavaScript is executed, so it's just technically impossible to connect both runtimes in any way that works on client machine, you'd need a customized browser, which is what Electron basically is. And neither should you want to - if the runtimes were connected in that way, any user could execute arbitrary commands on your server.

Chatbot using Api.ai nodejs angular socket.io

I have been using api.ai javascript SDK on angular to build my chat app to integrate it with the website. As this javascript sfk is deprecated I am now exploring to build the same on Node JS SDK with socket.io for real-time experience and angular for client features...
Currently, I'm following the below link to build my chat app
https://codingblast.com/chat-application-angular-socket-io/
As I am very new to Node I have lots of doubt like...
How to deploy my node and angular app on a server to host it on my website
Angular and node can it be deployed as a simple app.. if so what are the steps and how could I achieve it.
Is node is possible ti have multi threading as many users might chat with my chatbot in parallel before on angular it will be acheived by session id.. but how it is possible on the node?
Is it fine to deploy my node app on my existing apache server or should I use separate server
How can I host multiple node js chat app on a single server since each app will use a port... how much it is possible...
Which server is recommended for node deployment windows ubuntu or Linux.
Please help me...
Angular Apps are static files that can be served using any server. For NodeJS, you will need a server that supports NodeJS runtime execution environment. A simple cloud server will do. (AWS or others that you may prefer)
Angular runs on the client-side, NodeJS runs on the server-side, there is no "Simple App Deployment" (as far as I've known). You need to run the NodeJS server code which will server the REST API, and send the Angular deployment files to the client with some file server. (Even the NodeJS server can do it)
"Node.js is a single threaded language which in background uses multiple threads to execute asynchronous code" [Source]
But you can use "fork" to run parallel tasks. For chatbot, you may consider using WebSockets.
It is possible to run NodeJS with Apache server, but how you want to deploy it depends on your decision and architecture. See HERE for more information.
Link in no. 4 should have answer this this.
NodeJS can be deployed on both Windows and Linux(Ubuntu) environment. It depends on how much you can spend, and how much benefit that expenditure will bring you. (Linux server operating systems are totally free, Windows servers aren't)

Can you convert MEAN applications with a compiler to App store?

As we all know you can use compilers as Cordova to convert web applications so you can upload your application to the app store.
This can easily be done when developing with HTML5 and Node.
But is it possible to convert a MEAN application (MongoDB, Express, Angular and Node)?
You can run nodejs server on mobile with jxcore, but I think you should run only client side part on cordova and api shall stay on server. Ideally, I think that api and client side must be separate projects.
No, you can't.
MEAN stack is full stack. You can make your frontend an app with cordova but you still need database and backend service.
But that's ok. Make your app mobile friendly and stick with your server to provide the data you need to make it work.
What you can do, it's to create hosted web app. This is existing web application, just wrapped to make it possible to submit to app store.
For this you can use Manfoldjs, for example Using Cordova Plugins in Hosted Web Apps or if you use Visual Studio, you can use Visual Studio Tools
for Apache Cordova.

Port Cordova plugin(database API) to Node.Js module?

I am using Couchbase products as a database to develop a suite of applications (mobile, web, desktop) with offline capability. Our app will be a Html + Css + Javascript that should be cross platform. Angular and PhoneGap also used for being able to use a MVC pattern and build for mobile.
We want to also use JxCore (Node.Js fork) as a separate back-end service that would talk with the Couchbase Server or Couchbase Lite depending on the type of the app. (WebApp would talk directly with the Couchbase Server hosted on a cluster and apps that are deployed on client devices will need to talk to Couchbase Lite(embedded) and sync with the Couchbase Server.
Currently Couchbase offers a SDK for Node.Js to talk to the Couchbase Server, but not something similar for Couchbase Lite. PhoneGap on the other side, has a plugin for Couchbase Lite but like I said before we would prefer a backend node.js that will talk with the database and expose a rest API which will be called by the client apps to work with the data in the database.
Is there any possibility I can adapt this Couchbase Lite plugin so I can use it with Node.js (don't worry that this plugin dont have any desktop platform, we can solve this).
Link to the Couchbase Lite Plugin:
https://github.com/couchbaselabs/Couchbase-Lite-PhoneGap-Plugin
Link to JxCore Plugin we use:
https://github.com/jxcore/jxcore-cordova
I don't know if this is doable, I am a dummy working with those technologies.
Please let me know if I need to clarify something, thanks!

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