tonywei
tonywei

Reputation: 725

Electron - Stand alone node js server

I'm trying to make a quiz game with electron, where client can open quiz page on localhost:8888 on their mobile phone.

The question is, can you make a web server application with electron, with shipping encrypted server.js (express.js script) and the user that install my app to NOT REQUIRED TO install node.js?

My app might look like this:

|-----------------------------|
|QuizApp Window         _ [] x|
|-----------------------------|
|Open 192.168.1.1:8888        |
|to start game on your mobile |
|                             |
-------------------------------

Upvotes: 1

Views: 2881

Answers (1)

rsp
rsp

Reputation: 111258

the question is, can you make web server application with electron, with shipping encrypted server.js (express.js script) and the user that install my app to NOT REQUIRED TO install node.js?

You can embed a Node server inside of your Electron app just like you can use any Node code there, and the user will not need to install anything more than for using any other Electron app especially - it will be especially easy if you don't want to spawn external processes but just use a framework like Express in Electron like you can do any other Node module.

But you will not be able to encrypt the server.js file in any way that wouldn't be very easy to decrypt by the user who wants to do it. This is not hard but fundamentally impossible, as the user will have to be able to encrypt it to run it so you need to give the user all of the information needed to decrypt it and there is no way around it.

If you want to keep the server code secret then you need to host it on your own server. If you want to do that then see some of those answers:

Upvotes: 3

Related Questions