From b75ec7d6e70dbaa5a254f01e49e0555b77af8897 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E5=91=98=E5=B0=8F=E5=A2=A8?= <2291200076@qq.com> Date: Sun, 27 Aug 2023 23:51:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AE=9A=E6=97=B6=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=EF=BC=8C=E9=83=A8=E7=BD=B2=E7=9B=B8=E5=85=B3=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/server.js | 17 +++++++++++++---- html/index.html | 15 ++++++++++----- index.js | 11 +++++++++++ package-lock.json | 48 +++++++++++++++++++++++++++++++++++++++++++++-- package.json | 11 ++++++----- pm2.sh | 17 +++++++++++++++++ spider/spider.js | 34 +++++++++++++++++++++++++++------ 7 files changed, 131 insertions(+), 22 deletions(-) create mode 100644 index.js create mode 100644 pm2.sh diff --git a/backend/server.js b/backend/server.js index 828949e..aeb9e69 100644 --- a/backend/server.js +++ b/backend/server.js @@ -2,6 +2,8 @@ const express = require('express'); const mysql = require('mysql'); const app = express(); +const port = 35590 + // 创建连接池 const pool = mysql.createPool({ connectionLimit: 5, // 设置连接池的大小 @@ -202,7 +204,14 @@ app.post('/api/nuclear_data/export', function (req, res) { }); }); -// 启动服务器 -app.listen(3000, function () { - console.log('Server is running on port 3000'); -}); + +function serve() { + // 启动服务器 + app.listen(port, function () { + console.log('Server is running on port ' + port); + }); +} + +module.exports = { + serve, +} \ No newline at end of file diff --git a/html/index.html b/html/index.html index 05141f9..6b46a23 100644 --- a/html/index.html +++ b/html/index.html @@ -61,6 +61,11 @@