29 lines
671 B
JavaScript
29 lines
671 B
JavaScript
const express = require('express');
|
|
const path = require('path');
|
|
const app = express();
|
|
const PORT = 5001;
|
|
|
|
// 静态文件服务
|
|
app.use(express.static(path.join(__dirname)));
|
|
|
|
// 测试页面
|
|
app.get('/test', (req, res) => {
|
|
res.sendFile(path.join(__dirname, 'test.html'));
|
|
});
|
|
|
|
// 健康检查
|
|
app.get('/health', (req, res) => {
|
|
res.json({
|
|
status: 'ok',
|
|
service: 'test-server',
|
|
timestamp: new Date().toISOString(),
|
|
version: '1.0.0'
|
|
});
|
|
});
|
|
|
|
// 启动服务器
|
|
app.listen(PORT, () => {
|
|
console.log(`测试服务器运行在 http://localhost:${PORT}`);
|
|
console.log(`测试页面: http://localhost:${PORT}/test`);
|
|
});
|