How to hide and package the nodejs back-end code

the front end is separated by the front end, and the front end can be packaged, but how to package the back end code at run time is unclear

take egg and express as examples. After, npm run dev runs, the whole code in the background is clear. How to compile

like c language or java?
Jul.07,2021

do not understand? How do users get your nodejs code? can you give an example of


js is originally a scripting language, but more importantly, if you package it, the global variables of nodejs may conflict


1. Confusion is OK.
2. You can try a tool like this to compile. https://github.com/pmq20/node.
3. Use docker, to close docker. I don't know whether it works or not. Some people say yes, and there are no best practices. I don't know much about it.

I learned that one of the simplest and most reliable ideas, the safest and the best to understand, is not easy to do.
encrypt the code asymmetrically.
step 1: generate a pair of RSA.
step 2: change the nodejs, to add the public key file. When reading the file, first perform the RSA decryption operation.
step 3: private key encryption of the project file.
step 4: the magic modified nodejs interpreter and the encrypted code are sent to the customer.
ha


if you want to meet your needs, it is recommended that the function be implemented in CPP. NodeJs calls the CPP module to achieve the purpose of confidentiality


Please refer to this article: CabloyJS full stack development journey (1): NodeJS backend compilation and packaging strategy


pkg to learn about it. Node can be packaged into binary executors under linux, windows, and macos.

Menu