I have a node js api service application. I don't want to share my code with client. so, i decide to make a build like react, ionic in node js. but, i don't have any idea. please help me to get build in node js or any other way to prevent my code. Thanks in advance.
Javascript is not a compiled code, the best you can do is minify and uglify it (obfuscate).
You can bundle your NodeJS project as you want, anyone accessing the obfuscated code will always be able to retro-engineering it.
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
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
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
has had first class support for Node.js, you can type your code in TypeScript and compile it usingtsc app.ts
Its createapp.js
.
Bytenode
tool truly compiles your JavaScript code intoV8 bytecode
.
You can take reference from Bytenode doc on npm and Typescript + Node + Express , I think its help you.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.