Run node.js app with node-webkit? - node.js

I have a nodejs app with modules, views etc..
Is it possible to open this app with node-webkit instead of opening it in the browser ?
Thanks.

Yes, it is. Node-WebKit is a package with browser + node web server. But I believe you will probably want to change your architecture, because you don't need the client-server style. If you run your app without any changes, node-WebKit will act just like node server and you still need a browser to access the app. There is no reason to use node-WebKit instead of pure node in this case.
To use node-WebKit embedded browser you should know that there are no need to start node server. The browser's JavaScript environment is already connected to node and you can execute node commands and packages direct from the JavaScript files (eg.: access file system from the browser, a dream to every web developer). It's like you are running a browser inside the server, without the need of make requests and receive responses... For this reason you don't need to use packages as socket.io, cause the communication is already established. But you can use the fact of node is a server to easily establish communication between different machines, for example.

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.

general question about reactJS, nodeJS and NPM

first, the "facts" that I know:
reactJS is frontend framework, after compiling it'll generate a bundle of html/js/css files that can be recognized by modern browsers, so the browser straightforward request the web host server for these static html files ;
nodeJS is a server-side environment, or sometimes people call it a backend framework, browsers don't understand nodeJS but have to request the web host server to interpret it and to send back the html response.
according to wiki, npm is a package manager for the JavaScript programming language. It is the default package manager for the JavaScript runtime environment Node.js.
my question is:
is my understanding correct
why reactJS also using npm and includes node_module, does it have something to do with nodeJS
Javascript is the programming language used in both Node.js and in the browser, but that's about as far as the similarities goes. Node uses the V8 engine, which is the same running in the chrome browser.
Even though they use the same engine, they are quite different. They both have plenty of APIs - most notably, the browser has the DOM (which allows you to render stuff to the screen). In Node.js you do not have the DOM, but there are other APIs, for accessing the filesystem for instance.
Since both are running JavaScript, you can try to run the same program both in node and in the browser, but it will sometimes fail. React is a front-end framework which uses the DOM, so if you try to run React in node, it will crash because in Node there is no DOM (Node has no screen to render to). If you try to run a program suited for Node.js in the browser, it will crash if it uses some Node-specific API.
The confusing bit is that npm is a package manager for JavaScript, not necessarily node (even though node is in the name..). Therefore, we can use npm also for web applications. (If we do, we need to use a bundler like webpack though).
Some npm modules might work both in the browser and in node, but some will only work on one of them. If the npm module requires some platform-spcific API (DOM for the browser for example) then it will not work for the other platform.
Hope that clears things out! I understand that it's a bit of a mess..

Is it possible to build a electron desktop app without node server?

I want to develop a desktop app with electron without using nodejs (i don't want to use any server, a plain desktop app) to access the local files in the machine.
Node.js is a Javascript runtime, using it doesn't mean you need to use it to run a server of any kind. In fact, Electron uses Node.js internally to implement "lower level operating system interactions", like the ability to read local files.

Can I run VueJS and NodeJS or related apps on Server that doesn't have NodeJS installed?

So I'm new to Vuejs and doesn't know anything about npm, node, and other javascript apps.
I wanted to switch to VueJS so that I can take away from JQuery. Been using AdminLTE for my projects before.
I wanted to use vue-admin now since it seems to address all of my needs. However, I have specific work area situations that seems to hinder learning Vue and other JS apps, these are:
The workspace folder (development) where I'm creating applications is hosted in the production server (Windows Server).
I think NodeJS isn't installed in the server
Adobe Coldfusion is used. I don't have a local server, so the production server is used when developing.
Question:
Will the production server run the app built with vue-admin even if the production server doesn't have NodeJS installed? (I have NodeJS locally).
I need to use Coldfusion for the logic of the application, specifically I'm using CFWheels right now and vue-admin for Frontend and UX. Is it possible? The application I'm making is closely related to parts of an ERP system.
Any pointers on how I could do this?
Yes you can. Most likely you will need NodeJS locally to make your development life a bit easier.
You can simply include Vue in your project with a script tag or your can use a buildtool like Webpack to enable you to write ES6 and use a module system.
If you go with the latter it still exports as plain ES5 allowing you to use it on your server without any problem since all of this is code which runs on the clients machine, not on your server.
As you can see the requirements for this project have a big bold headline with: 'Development'.
https://github.com/vue-bulma/vue-admin#development
You don't need any of the requirements in production.

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