feat: sync mixly static resources, tools and sw-mixly

This commit is contained in:
yczpf2019
2026-01-24 16:12:55 +08:00
parent c8c5fcf726
commit 01b756fed8
173 changed files with 39715 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
const http = require('http');
const express = require('express');
const path = require('path');
const apiRoutes = require('./api.js');
const StaticServer = {};
StaticServer.run = (port) => {
const app = express();
app.use(express.static(path.resolve(__dirname, '../')));
app.use('/api/', apiRoutes);
const httpServer = http.createServer(app);
httpServer.listen(port);
console.log('Static服务器正在运行 [端口 - ' + port + ', http]...');
console.log('访问地址http://127.0.0.1:' + port);
StaticServer.server = httpServer;
StaticServer.app = app;
StaticServer.port = port;
StaticServer.protocol = 'http';
}
module.exports = StaticServer;