From 9ed73e48fc5be2155ec7d312ffccf603ca142a9c Mon Sep 17 00:00:00 2001 From: Avril Date: Thu, 30 Jan 2020 17:20:05 +0000 Subject: [PATCH] remove unnecisary async lambda --- debug.js | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/debug.js b/debug.js index 2a8ea59..6929c75 100644 --- a/debug.js +++ b/debug.js @@ -5,21 +5,19 @@ const fs = require('fs'), console.log("Starting static server on port "+config.STATIC_PORT); -(async () => { - await http.createServer((req, res) => { - let url = req.url; - if(!req.url || req.url == "" || req.url == "/") url = "/index.html"; - fs.readFile(config.STATIC_LOCATION + url, (err, data) => { - if(err) { - console.log("Failed to retreive requested url '"+url+"': "+err); - res.writeHead(404); - res.end(JSON.stringify(err)); - return; - } else { - console.log("Writing "+url); - res.writeHead(200); - res.end(data); - } - }); - }).listen(config.STATIC_PORT); -})(); +http.createServer((req, res) => { + let url = req.url; + if(!req.url || req.url == "" || req.url == "/") url = "/index.html"; + fs.readFile(config.STATIC_LOCATION + url, (err, data) => { + if(err) { + console.log("Failed to retreive requested url '"+url+"': "+err); + res.writeHead(404); + res.end(JSON.stringify(err)); + return; + } else { + console.log("Writing "+url); + res.writeHead(200); + res.end(data); + } + }); +}).listen(config.STATIC_PORT);