feat: 新增 nodejs 实验 8
This commit is contained in:
22
Server/tests/test8/app.js
Normal file
22
Server/tests/test8/app.js
Normal 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}`);
|
||||
})
|
||||
Reference in New Issue
Block a user