From 61f2851246eda31032ad900d9ca8855bcbc44fab 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 = ` - - + +