feat: 新增 nodejs 实验 8

This commit is contained in:
2025-12-09 11:08:15 +08:00
parent 11b4998dca
commit ad1a6a22e9
8 changed files with 535 additions and 0 deletions

22
Server/tests/test8/app.js Normal file
View File

@@ -0,0 +1,22 @@
const koa = require("koa");
const bodyParser = require("koa-bodyparser");
const path = require("path");
const koaStatic = require("koa-static")
const routes = require("./routes/routes");
const indexRoutes = require("./routes/index");
const db = require("./db")
const app = new koa();
app.use(bodyParser());
app.use(routes.routes());
app.use(routes.allowedMethods());
app.use(koaStatic(path.join(__dirname, "public")));
const port = 3000;
app.listen(port, () => {
console.log(`Server is running on http://localhost:${port}`);
})