From e48059ac824b3bd7c70d98c594bb29fb7bd14ab6 Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Sat, 23 Sep 2017 21:31:06 -0400 Subject: [PATCH] Move client js to 'js' subfolder, rename script.js to playfield.js --- script.js => js/playfield.js | 0 server.js | 20 +++++++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) rename script.js => js/playfield.js (100%) diff --git a/script.js b/js/playfield.js similarity index 100% rename from script.js rename to js/playfield.js diff --git a/server.js b/server.js index c9762ed..ecc0599 100644 --- a/server.js +++ b/server.js @@ -19,11 +19,17 @@ const server = http.createServer((req, res) => { case 'style.css': sendFile(res, 'style.css', 'text/css'); break; - case 'script.js': - sendFile(res, 'script.js', 'application/javascript'); - break; - case 'interact.js': - sendFile(res, 'interact.js', 'application/javascript'); + case 'js': + switch (pathParts[2] || "") { + case 'playfield.js': + sendFile(res, 'js/playfield.js', 'application/javascript'); + break; + case 'interact.js': + sendFile(res, 'interact.js', 'application/javascript'); + break; + default: + send404(res, uri); + } break; case 'deck': if (pathParts.length === 3) { @@ -89,8 +95,8 @@ function sendPlayfield(res, deckName) { const html = ` - - + +