简体   繁体   English

可以在Node js后端代码中进行构建吗? 如果是的话,如何使用npm获取节点js?

[英]can i get build in node js back-end code ? if yes means, how to get node js build using npm?

I have a node js api service application. 我有一个节点js api服务应用程序。 I don't want to share my code with client. 我不想与客户共享我的代码。 so, i decide to make a build like react, ionic in node js. 因此,我决定在node js中进行类似react,ionic的构建。 but, i don't have any idea. 但是,我没有任何想法。 please help me to get build in node js or any other way to prevent my code. 请帮助我建立节点js或其他任何方式来阻止我的代码。 Thanks in advance. 提前致谢。

Javascript is not a compiled code, the best you can do is minify and uglify it (obfuscate). Javascript不是经过编译的代码,您可以做的最好的事情就是将其最小化和丑化(模糊处理)。

You can bundle your NodeJS project as you want, anyone accessing the obfuscated code will always be able to retro-engineering it. 您可以根据需要捆绑NodeJS项目,任何访问混淆代码的人始终可以对其进行重新设计。

There are multiple ways to do it, here is one (not tested myself) : https://ourcodeworld.com/articles/read/607/how-to-obfuscate-javascript-code-with-node-js 有多种方法可以执行此操作,这是一种方法(未经我自己测试): https : //ourcodeworld.com/articles/read/607/how-to-obfuscate-javascript-code-with-node-js

You can bundle a NodeJS as an executable : https://dev.to/jochemstoel/bundle-your-node-app-to-a-single-executable-for-windows-linux-and-osx-2c89 您可以将NodeJS捆绑为可执行文件: https : //dev.to/jochemstoel/bundle-your-node-app-to-a-single-executable-for-windows-linux-and-osx-2c89

Yes, There are multiple ways but as per my opinion two way is good first create a build using TypeScript and second way convert your nodejs code into Byte using Bytenode 是的,有多种方法,但据我认为,两种方法都很好,一种是使用TypeScript创建一个构建,第二种是使用Bytenode将nodejs代码转换为Byte。

TypeScript has had first class support for Node.js, you can type your code in TypeScript and compile it using tsc app.ts Its create app.js . TypeScript已经具备了Node.js的一流的支持,您可以在打字稿键入的代码,并使用编译tsc app.ts其创建app.js

Bytenode tool truly compiles your JavaScript code into V8 bytecode . Bytenode工具可将您的JavaScript代码真正编译为V8 bytecode

You can take reference from Bytenode doc on npm and Typescript + Node + Express , I think its help you. 您可以参考npmTypescript + Node + Express 上的Bytenode文档 ,我认为它可以为您提供帮助。

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

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