diff options
author | yuto0214w <yuto0214w@gmail.com> | 2021-11-08 12:14:01 +0900 |
---|---|---|
committer | Masahiro FUJIMOTO <mfujimot@gmail.com> | 2021-11-09 23:30:51 +0900 |
commit | 217c880305105538cea04f0834eadde9cc53dbc7 (patch) | |
tree | 94c1ad7c2c07ad8f088c033a21e78b44f5ca8e9a /files/ko/learn | |
parent | 7dd5e4f16734dae80756c170c2680c98f6679368 (diff) | |
download | translated-content-217c880305105538cea04f0834eadde9cc53dbc7.tar.gz translated-content-217c880305105538cea04f0834eadde9cc53dbc7.tar.bz2 translated-content-217c880305105538cea04f0834eadde9cc53dbc7.zip |
Sync codes on node_server_without_framework
Diffstat (limited to 'files/ko/learn')
-rw-r--r-- | files/ko/learn/server-side/node_server_without_framework/index.html | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/files/ko/learn/server-side/node_server_without_framework/index.html b/files/ko/learn/server-side/node_server_without_framework/index.html index 26188a064a..fe878352ce 100644 --- a/files/ko/learn/server-side/node_server_without_framework/index.html +++ b/files/ko/learn/server-side/node_server_without_framework/index.html @@ -27,32 +27,34 @@ http.createServer(function (request, response) { console.log('request ', request.url); var filePath = '.' + request.url; - if (filePath == './') + if (filePath == './') { filePath = './index.html'; + } var extname = String(path.extname(filePath)).toLowerCase(); var mimeTypes = { - '.html': 'text/html', + '.html': 'text/html', '.js': 'text/javascript', '.css': 'text/css', '.json': 'application/json', '.png': 'image/png', '.jpg': 'image/jpg', '.gif': 'image/gif', + '.svg': 'image/svg+xml', '.wav': 'audio/wav', '.mp4': 'video/mp4', '.woff': 'application/font-woff', '.ttf': 'application/font-ttf', '.eot': 'application/vnd.ms-fontobject', '.otf': 'application/font-otf', - '.svg': 'application/image/svg+xml' + '.wasm': 'application/wasm' }; var contentType = mimeTypes[extname] || 'application/octet-stream'; fs.readFile(filePath, function(error, content) { if (error) { - if(error.code == 'ENOENT'){ + if(error.code == 'ENOENT') { fs.readFile('./404.html', function(error, content) { response.writeHead(404, { 'Content-Type': 'text/html' }); response.end(content, 'utf-8'); @@ -61,7 +63,6 @@ http.createServer(function (request, response) { else { response.writeHead(500); response.end('Sorry, check with the site admin for error: '+error.code+' ..\n'); - response.end(); } } else { |