| const express = require('express'); | |
| const path = require('path'); | |
| const app = express(); | |
| const PORT = process.env.PORT || 3000; | |
| // 设置静态文件目录 | |
| app.use(express.static(path.join(__dirname, '/'))); | |
| // 启动服务 | |
| app.listen(PORT, () => { | |
| console.log(`Server is running on http://localhost:${PORT}`); | |
| console.log(`Open http://localhost:${PORT} in your browser to view the site.`); | |
| }); | |