This commit is contained in:
zjt
2024-05-21 21:59:30 +08:00
commit bfbed61780
21 changed files with 114397 additions and 0 deletions

17
src/server.ts Normal file
View File

@@ -0,0 +1,17 @@
import Koa from "koa";
import router from "./routers/router";
import bodyParser from "koa-bodyparser";
import InitHandler from "./routers/handler";
// 使用路由
const app = new Koa();
app.use(bodyParser());
app.use(router.routes()).use(router.allowedMethods());
InitHandler();
console.log(router);
// 启动服务器
const PORT = 3000;
app.listen(PORT, () => {
console.log(`Server is running on http://localhost:${PORT}`);
});