1 Star 0 Fork 0

Niklaus9084/html工具

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
server.js 946 Bytes
一键复制 编辑 原始数据 按行查看 历史
Niklaus9084 提交于 2024-11-29 09:38 +08:00 . 汇总页面;调整node_modules位置
// server.js
const express = require('express');
const path = require('path');
const app = express();
// 提供 public 目录下的静态文件
app.use(express.static(path.join(__dirname, 'public')));
// 提供 node_modules 目录下的静态文件
app.use('/node_modules', express.static(path.join(__dirname, 'node_modules')));
app.use('/serial-data-analysis',express.static(path.join(__dirname, 'serial-data-analysis')));
app.use('/thrust-calcuation',express.static(path.join(__dirname, 'thrust-calcuation')));
// 默认路由,返回 index.html
app.get('/', (req, res) => {
res.sendFile(path.join(__dirname, 'public', 'index.html'));
});
// 启动服务器,监听 3000 端口
app.listen(3000, () => {
console.log('Server running at http://localhost:3000');
});
//停止服务器
process.on('SIGINT', () => {
console.log('接收到停止信号');
server.close(() => {
console.log('服务器已停止');
});
});
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/Niklaus9084/html-tools.git
git@gitee.com:Niklaus9084/html-tools.git
Niklaus9084
html-tools
html工具
master

搜索帮助