2222
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
编码猿
2025-09-09 11:13:47 +08:00
parent 27cc128f6e
commit 6cd75c4a50
3 changed files with 869 additions and 2 deletions

View File

@@ -4,10 +4,11 @@ const { port, command } = require('./config');
const express = require('express')
const app = express()
const { join } = require('path');
// 配置静态文件目录
// 这会将项目中的public文件夹设置为静态资源目录
app.use(express.static(path.join(__dirname, 'public')));
app.use(express.static(join(__dirname, 'public')));
app.use((req, res, next) => {
res.header('Access-Control-Allow-Origin', '*');
@@ -23,7 +24,7 @@ app.get('/ip', async (req, res) => {
app.get('/', async (req, res) => {
// 使用sendFile方法发送HTML文件
res.sendFile(path.join(__dirname, 'public', 'index.html'));
res.sendFile(join(__dirname, 'public', 'index.html'));
})
app.listen(port, () => {