Publish Windows service in Microsoft store with NodeJS or Electron - node.js

I'm looking for a the golden advice.
I've created an app that listens to websockets over a certain port and then sends commands to a native module (wrapped by NodeJS). now all this is done in NodeJS app. and packed in exe file (with two extra files for the native module ".dll and .napi")
now I want two things:
Run this app as a windows service in the background.
Package it in an installer that should stop the service (if exists), install the new update, then re-run the service. this app will be published in Microsoft store as appx.
I'm new to all of this so I feel lost while trying to know which is the best approach with my little knowledge.
I'm a bit confused between NodeJS and ElectronJS, some people say electron is not the best choice for services, but electron-builder is a great tool for packaging.
Conclusion: I want to publish my app to Microsoft store (already bought a developer account), and to run it as a service (no GUI). and the code is written in JS (node or electron)
Thanks in advance

Related

Can you easily explain the process of deploying ionic (based on react) apps with a node backend?

I recently started using react with a node server as a backend. I'm having problems to understand how to deploy such an app. I'm a beginner with ionic and deploying websites (or rather web based mobile apps) so I apologize if this is an easy/stupid question.
I searched a lot about this but my brain is still struggling to understand the deployment process. As I understand, any website have generally two parts, the frontend built with HTML/CSS/JS and the backend built with nodejs (in my case). If I want to run the app, I need to type npm start in the terminal right? so I'm only running the node server actually, where it will serve the HTML pages (static pages) depending on which url endpoint I wrote, right?
So deploying this is "easy" by copying the static files into a remote server and just run the nodeJs server to serve pages depending on the request, right. Therefore, is the start command here npm start, which will start the whole app.
I'm now using the ionic framework with react syntax and nodejs in the backend. There is a special command to run the ionic app (frontend), which is ionic serve. So if I run this the frontend will show up in the browser. Furthermore, I need to run the node server with npm start to handle requests. Therefore, to start my app, I need the ionic serve and npm start commands. How can this be deployed?
After some research, I read that I need to deploy the ionic app (frontend) and the backend separately. For example the ionic app would be a webapp and the server also a separate webapp (since I'm using MS Azure). The communication between them can be over rest API or web sockets as I understand. Is this the right approach to do this or there is a better/more clear way?
deploying two apps would mean that I need to pay for two apps on azure. Is there a way to minimize costs and have a functional app?
PS: generally, I'm having problems to understand the deployment process. I understand basically how the web works and I can build website on my machine but I'm not confident about my skills when it comes to deployment. Surprisingly, there is not much on the internet about it. Can someone please recommend articles, books or ideally videos that explain this process. Thank you in advance.
here is how you deploy ionic apps as pwa - https://ionicframework.com/docs/react/pwa
if you are using a node backend, the you would start the server same as you would normally, If I am understanding the question
Though your question is not specific to a particular issue but highlights a wide variety of issues, i will still try to explain it.
Ionic is primarily used for creating HYBRID/WEB MOBILE APPLICATIONS. Although you can deploy the code as a website too, but you will not be able to get any benefit out of using ionic for a website only and not using react as a standalone framework.
Be clear on your requirement, your question talks about website and web based mobile apps. Deploying a website and a hybrid mobile application is not one and the same thing. Websites are hosted on servers, mobile apps are deployed in app stores.
If you are not going to deploy to any mobile platform, i suggest you drop ionic and build your website with react.
Now coming to Ionic mobile apps, this is the flow
Create Ionic Project -> Build project for iOS/Android platform -> Deploy these apps to respective app stores
You will not host your Ionic mobile code on any hosting provider.
Your node.js backend code gets hosted on a hosting service. The endpoint URL will change to your hosted servers IP address.
Read about following topics first
What are hybrid mobile applications
What is Ionic
How to build mobile apps using Ionic
Publishing Mobile Applications
Deploying node.js to a cloud host

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)

Node JS web application to LAN application( Desktop App)

I am very new to Node JS. recently developed a web application in NodeJS & hosted it on a common server along with Database for a clinical management.
Now I have an immediate requirement of making it as a desktop application so that users in a clinic can run the exe on their desktop and the application where its installed will create a database for other users to connect and make their updates.
Checked articles with Electron, node-webkit but didn't work for my current solution.
Is there any other alternative solution where I can make it as a desktop for Windows and Mac. Seeking your kind help !!!
There is the software NEXE which shows promising results however, when it comes down too it, Node.JS is a perfectly fine platform for production environments and is quite performant for the use-case you suggest. You can bundle a Node.JS installation and call upon it from your C code using system, exec or spawn calls. You can also open your favourite browser from the command line, while Google Chrome has the --kiosk flag to show in widescreen by default.
Just some ideas.

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.

how to install node modules for node app on public web server?

I am creating a webapp which will be used by the users around the globe. In order to use the app, they have to go to the give url and use the hardware called Neurosky Mindwave. This hardware will capture their EEG signals and send it to the webapp so that users can see their brain activity in the webapp.
I have successfully created the app using this node module and I was able to run the app locally but now I need to move this app to my hosting hosting gator server and I don't know how to do that.
On my local machine this node-module is able to capture the data from the TGC [think gear connector] which actually ports the incoming data from EEG headset [Neurosky Mindwave] to the app using local ws//127.0.0.1. Now I am not able to understand how to move this app to my hosting website. Can I do that? or hosting gator doesn't support or allow node modules to be installed?
What I believe is that the most important part is node-neurosky-module which my app requires in order to connect with the external hardware. I think I probably don't need nodejs server in order to use this module instead I can use something else but I might be wrong as I am less experience with this kind of technology.
In simple terms -
EEG Headset [Neurosky Mindwave]---signals---> TGC [thinkgear connector] ---> Node-Neurosky-Module [running on nodejs server ws//127.0.0.1] ----> Web app
This is my app directory structure
NeuroskyWebApp --
css
bootstrap.min.css
js
bootstrap.min.js
custom.js
jquery.1.2.1.min.js
node
app.js
node-modules
node-neurosky --> some more files ...
options --> some more files ...
ultron --> some more files ...
ws --> some more files ...
index.html
node.js and the package that you mentioned node-neurosky-module run on the server, not the browser. So there is no way for your users to run the application by just visiting a url, they need to run the same node server application that you have now on their machines to capture EEG device input.
Fortunately, there are frameworks that you can use to package your whole application (node server and html pages) in a standalone desktop app that works on all operating systems. You can google "javascript desktop". The most popular of these frameworks is electron which I recommend for your case. You can easily find tutorials on youtube to get started with it.

Resources