diff --git a/app.js b/app.js index 8e91091..5156b0c 100644 --- a/app.js +++ b/app.js @@ -7,21 +7,20 @@ const url = require("url"); const port = 8080; const host = "0.0.0.0"; const mimeTypes = { - ".html": "text/html", - ".css": "text/css", - ".js": "application/javascript", - ".svg": "image/svg+xml", - ".png": "image/png", - ".jpg": "image/jpeg", - ".jpeg": "image/jpeg", - ".gif": "image/gif", - ".ico": "image/x-icon", - ".json": "application/json", - ".txt": "text/plain", + ".html": "text/html", + ".css": "text/css", + ".js": "application/javascript", + ".svg": "image/svg+xml", + ".png": "image/png", + ".jpg": "image/jpeg", + ".jpeg": "image/jpeg", + ".gif": "image/gif", + ".ico": "image/x-icon", + ".json": "application/json", + ".txt": "text/plain", }; -http - .createServer((req, res) => { +http.createServer((req, res) => { // Parse the URL and extract just the pathname, ignoring query parameters const parsedUrl = url.parse(req.url); let filePath = "." + decodeURIComponent(parsedUrl.pathname); @@ -31,15 +30,14 @@ http const contentType = mimeTypes[ext] || "application/octet-stream"; fs.readFile(filePath, (err, content) => { - if (err) { - res.writeHead(404); - res.end("404 Not Found"); - } else { - res.writeHead(200, { "Content-Type": contentType }); - res.end(content); - } + if (err) { + res.writeHead(404); + res.end("404 Not Found"); + } else { + res.writeHead(200, { "Content-Type": contentType }); + res.end(content); + } }); - }) - .listen(port, host, () => { +}).listen(port, host, () => { console.log(`Server running at http://${host}:${port}/`); - }); +}); diff --git a/index.html b/index.html index cd6b48e..7655adb 100644 --- a/index.html +++ b/index.html @@ -22,88 +22,88 @@ */ --> -

HTML5 Gamepad Test

-
running:
-
+

HTML5 Gamepad Test

+
running:
+