Implement hexagonal map and isometric game UI

This commit is contained in:
sokol
2026-02-21 17:23:09 +03:00
parent afd48af0b8
commit 25385de4d4
11 changed files with 2146 additions and 0 deletions

46
server.js Normal file
View File

@@ -0,0 +1,46 @@
const http = require('http');
const fs = require('fs');
const path = require('path');
const PORT = 8080;
const MIME_TYPES = {
'.html': 'text/html',
'.css': 'text/css',
'.js': 'application/javascript',
'.json': 'application/json',
'.png': 'image/png',
'.jpg': 'image/jpeg',
'.gif': 'image/gif',
'.svg': 'image/svg+xml',
'.ico': 'image/x-icon'
};
const server = http.createServer((req, res) => {
let filePath = req.url === '/' ? '/index.html' : req.url;
filePath = path.join(__dirname, 'public', filePath);
const ext = path.extname(filePath);
const contentType = MIME_TYPES[ext] || 'application/octet-stream';
fs.readFile(filePath, (err, content) => {
if (err) {
if (err.code === 'ENOENT') {
res.writeHead(404);
res.end('File not found');
} else {
res.writeHead(500);
res.end('Server error');
}
} else {
res.writeHead(200, { 'Content-Type': contentType });
res.end(content);
}
});
});
server.listen(PORT, () => {
console.log(`\n=== HEXO Game Server ===`);
console.log(`Server running at http://localhost:${PORT}/`);
console.log(`Press Ctrl+C to stop\n`);
});