fix: 修复拖拽问题,松开鼠标结束拖动,互不影响

This commit is contained in:
Zhukj
2026-04-14 18:00:00 +08:00
commit ba45fd0592
4 changed files with 839 additions and 0 deletions

28
server.js Normal file
View File

@@ -0,0 +1,28 @@
const http = require('http');
const fs = require('fs');
const path = require('path');
const server = http.createServer((req, res) => {
const filePath = req.url === '/' ? 'index.html' : req.url.slice(1);
const ext = path.extname(filePath);
const mimeTypes = {
'.html': 'text/html',
'.js': 'application/javascript',
'.css': 'text/css'
};
fs.readFile(path.join(process.cwd(), filePath), (err, data) => {
if (err) {
res.writeHead(404);
res.end('Not Found');
return;
}
res.writeHead(200, { 'Content-Type': mimeTypes[ext] || 'text/plain' });
res.end(data);
});
});
server.listen(0, () => {
const port = server.address().port;
console.log('Server running on http://localhost:' + port);
});