diff options
| author | Andrew Lee <alee14498@gmail.com> | 2019-08-31 11:37:47 -0400 |
|---|---|---|
| committer | Andrew Lee <alee14498@gmail.com> | 2019-08-31 11:37:47 -0400 |
| commit | 96021d7aa269aa446ce86bf0d3e4672b69636b2c (patch) | |
| tree | c4c60542150bde85d298b1a2fac70bd7c992452b /app.js | |
| parent | 8224c6403299bc4967c23de6cea70689c57b42ab (diff) | |
| download | Project-TechRPG-96021d7aa269aa446ce86bf0d3e4672b69636b2c.tar.gz Project-TechRPG-96021d7aa269aa446ce86bf0d3e4672b69636b2c.tar.bz2 Project-TechRPG-96021d7aa269aa446ce86bf0d3e4672b69636b2c.zip | |
Stuff
Diffstat (limited to 'app.js')
| -rw-r--r-- | app.js | 34 |
1 files changed, 34 insertions, 0 deletions
@@ -0,0 +1,34 @@ +const express = require('express'); +const http = require('http'); +const app = express(); +const port = 4000; + +// Require Filesystem module +const fs = require("fs"); + +// Require the Obfuscator Module +const JavaScriptObfuscator = require('javascript-obfuscator'); + +// Read the file of your original JavaScript Code as text +fs.readFile('./src/js/main.js', "UTF-8", function(err, data) { + if (err) { + throw err; + } + + // Obfuscate content of the JS file + const obfuscationResult = JavaScriptObfuscator.obfuscate(data); + + // Write the obfuscated code into a new file + fs.writeFile('./public/js/main.js', obfuscationResult.getObfuscatedCode() , function(err) { + if(err) { + return console.log(err); + } + + console.log("The file was saved!"); + }); +}); + +app.use(express.static(__dirname + '/public')); + +console.log(`Started the server in port ${port}`); +http.createServer(app).listen(port);
\ No newline at end of file |
