-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.js
55 lines (49 loc) · 1.26 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
const express = require("express");
const bodyParser = require("body-parser");
const path = require("path");
const app = express();
const homeRouter = require("./routes/homeRouter");
const taskRouter = require("./routes/taskie");
// const taskRouter2 = require("./routes/task2");
// const taskRouter3 = require("./routes/task3");
// const taskRouter4 = require("./routes/task4");
const errorRouter = require("./routes/error");
app.use(bodyParser.urlencoded({ extended: false }));
app.use(express.static(path.join(__dirname, "public")));
app.use(express.static(path.join(__dirname, "views")));
app.use(homeRouter);
// var ch = 1;
// switch (ch) {
// case 1:
// app.use(taskRouter.router1);
// break;
// case 2:
// app.use(taskRouter);
// break;
// case 3:
// app.use(taskRouter);
// break;
// case 4:
// app.use(taskRouter);
// break;
// // }
// task = Math.floor(Math.random() * 4);
// console.log(task);
// switch (task) {
// case 0:
// app.use(taskRouter1);
// break;
// case 1:
// app.use(taskRouter3);
// break;
// case 2:
// app.use(taskRouter3);
// break;
// case 3:
// app.use(taskRouter4);
// break;
// }
app.use(taskRouter);
app.use(errorRouter);
console.log("it has started!");
app.listen(2000);