把Nodejs服务器后端上传

This commit is contained in:
2025-03-07 14:48:59 +08:00
parent 7fdd7adc47
commit 2201147ccc
9 changed files with 1632 additions and 0 deletions

21
Servers/测试/json.js Normal file
View File

@@ -0,0 +1,21 @@
const fs = require('fs');
const path = require('path');
// 构建 JSON 文件的路径
const filePath = path.join(__dirname, 'Players', 'player.json');
// 读取 JSON 文件
fs.readFile(filePath, 'utf8', (err, data) => {
if (err) {
console.error('读取文件时出错:', err);
return;
}
try {
// 解析 JSON 数据
const playerData = JSON.parse(data);
console.log('玩家数据:', playerData);
} catch (parseErr) {
console.error('解析 JSON 数据时出错:', parseErr);
}
});