diff --git a/app.js b/app.js index 8f6ffce..7887e68 100644 --- a/app.js +++ b/app.js @@ -15,7 +15,7 @@ var con = mysql.createConnection({ password: "Wnc4q_75", database: "minis", ssl: { - ca: fs.readFileSync (process.cwd() + "/mysql-ca.ctf") + ca: fs.readFileSync(process.cwd() + "/mysql-ca.ctf") } }); @@ -29,7 +29,7 @@ con.connect(err => { app.get('/', (req, res) => { - if(!isConnected()){res.send("No Connection to database
" + JSON.stringify(cause) + "
" + toString(con));return} + if(!isConnected()){res.send("No Connection to database
" + JSON.stringify(cause) + "
" + fs.readFileSync(process.cwd() + "/mysql-ca.ctf"));return} res.send("Welcome to the miniplan api!"); }); @@ -144,22 +144,6 @@ app.listen(3000, () => { console.log("API started!"); }); -function toString(string){ - var cache = []; - var r = JSON.stringify(string, function(key, value) { - if (typeof value === 'object' && value !== null) { - if (cache.indexOf(value) !== -1) { - // Circular reference found, discard key - return; - } - // Store value in our collection - cache.push(value); - } - return value; - }); - cache = null; // Enable garbage collection - return r; -} function isConnected(){ if(con.isConnected){