Use path.join instead of string concat

This commit is contained in:
Adam Goldsmith 2018-12-19 15:13:29 -05:00
parent 127394a729
commit b4c930ffd0

View File

@ -25,7 +25,7 @@ const server = http.createServer((req, res) => {
case 'playfield.css': case 'playfield.css':
case 'editor.css': case 'editor.css':
case 'common.css': case 'common.css':
sendFile(res, 'css/' + pathParts[2], 'text/css'); sendFile(res, path.join('css', pathParts[2]), 'text/css');
break; break;
default: default:
send404(res, uri); send404(res, uri);
@ -36,7 +36,7 @@ const server = http.createServer((req, res) => {
case 'playfield.js': case 'playfield.js':
case 'editor.js': case 'editor.js':
case 'interact.js': case 'interact.js':
sendFile(res, 'js/' + pathParts[2], 'application/javascript'); sendFile(res, path.join('js', pathParts[2]), 'application/javascript');
break; break;
default: default:
send404(res, uri); send404(res, uri);
@ -52,7 +52,7 @@ const server = http.createServer((req, res) => {
case "environment/input.json": case "environment/input.json":
case "hero/input.json": case "hero/input.json":
case "villain/input.json": case "villain/input.json":
sendFile(res, "template/" + item, 'application/json'); sendFile(res, path.join("template", item), 'application/json');
break; break;
case "environment/deck.svg": case "environment/deck.svg":
case "hero/deck.svg": case "hero/deck.svg":
@ -61,7 +61,7 @@ const server = http.createServer((req, res) => {
case "villain/deck.svg": case "villain/deck.svg":
case "villain/character.svg": case "villain/character.svg":
case "villain/instructions.svg": case "villain/instructions.svg":
sendFile(res, "template/" + item, 'image/svg+xml'); sendFile(res, path.join("template", item), 'image/svg+xml');
break; break;
default: default:
send404(res, uri); send404(res, uri);