单人单台扫描终端支持10分钟内完成≥50个牙列或牙体雕刻作品高速扫描采集

This commit is contained in:
2026-06-06 19:46:14 +08:00
commit 0a86816b55
7 changed files with 2684 additions and 0 deletions

40
server.cjs Normal file
View File

@@ -0,0 +1,40 @@
const http = require("http");
const fs = require("fs");
const path = require("path");
const root = __dirname;
const port = Number(process.env.PORT || 4173);
const types = {
".html": "text/html;charset=utf-8",
".css": "text/css;charset=utf-8",
".js": "text/javascript;charset=utf-8",
};
const server = http.createServer((request, response) => {
const url = new URL(request.url, `http://localhost:${port}`);
const requestedPath = url.pathname === "/" ? "index.html" : url.pathname.slice(1);
const filePath = path.resolve(root, requestedPath);
if (!filePath.startsWith(root)) {
response.writeHead(403);
response.end("Forbidden");
return;
}
fs.readFile(filePath, (error, buffer) => {
if (error) {
response.writeHead(404);
response.end("Not found");
return;
}
response.writeHead(200, {
"Content-Type": types[path.extname(filePath)] || "application/octet-stream",
});
response.end(buffer);
});
});
server.listen(port, "127.0.0.1", () => {
console.log(`Dental 3D demo: http://localhost:${port}`);
});