Move client js to 'js' subfolder, rename script.js to playfield.js

This commit is contained in:
Adam Goldsmith 2017-09-23 21:31:06 -04:00
parent 3c2190b940
commit e48059ac82
2 changed files with 13 additions and 7 deletions

View File

@ -19,11 +19,17 @@ const server = http.createServer((req, res) => {
case 'style.css': case 'style.css':
sendFile(res, 'style.css', 'text/css'); sendFile(res, 'style.css', 'text/css');
break; break;
case 'script.js': case 'js':
sendFile(res, 'script.js', 'application/javascript'); switch (pathParts[2] || "") {
break; case 'playfield.js':
case 'interact.js': sendFile(res, 'js/playfield.js', 'application/javascript');
sendFile(res, 'interact.js', 'application/javascript'); break;
case 'interact.js':
sendFile(res, 'interact.js', 'application/javascript');
break;
default:
send404(res, uri);
}
break; break;
case 'deck': case 'deck':
if (pathParts.length === 3) { if (pathParts.length === 3) {
@ -89,8 +95,8 @@ function sendPlayfield(res, deckName) {
const html = ` const html = `
<html> <html>
<head> <head>
<script src="/interact.js"></script> <script src="/js/interact.js"></script>
<script src="/script.js"></script> <script src="/js/playfield.js"></script>
<link rel="stylesheet" type="text/css" href="/style.css"> <link rel="stylesheet" type="text/css" href="/style.css">
</head> </head>
<body> <body>