简体   繁体   English

Electron - 独立节点js服务器

[英]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. 我正在尝试用电子制作一个问答游戏,客户可以在他们的手机上打开localhost:8888上的测验页面。

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? 问题是,你能用电子制作一个web服务器应用程序,运送加密的server.js(express.js脚本)和安装我的应用程序的用户不需要安装node.js吗?

My app might look like this: 我的应用可能如下所示:

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

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? 问题是,你能用电子制作网络服务器应用程序,运送加密的server.js(express.js脚本)和安装我的应用程序的用户不需要安装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. 你可以在你的Electron应用程序中嵌入一个Node服务器,就像你可以在那里使用任何Node代码一样,用户不需要安装任何东西,特别是使用任何其他Electron应用程序 - 如果你不这样做,它会特别容易想要产生外部进程,但只需使用像Electron中的Express这样的框架,就像你可以做任何其他Node模块一样。

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. 但是,您将无法以任何方式加密server.js文件,而这种方式对于想要执行该操作的用户来说不是很容易解密。 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: 如果你想这样做,那么看看其中一些答案:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM