123456789101112131415161718 |
- import express from "express";
- import path from "path";
- const staticDir = path.resolve(__dirname, "test");
- console.log(staticDir);
- let startup = false;
- export async function createServer(port: number) {
- if (startup) {
- return;
- }
- const app = express();
- app.use(express.static(staticDir));
- app.listen(port);
- startup = true;
- console.log("模拟环境已开启");
- }
|