remove unnecisary async lambda

master
Avril 5 years ago
parent 691c14eede
commit 9ed73e48fc
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -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);

Loading…
Cancel
Save