-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ts
52 lines (41 loc) Β· 1.22 KB
/
index.ts
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
import * as express from "express";
import 'express-async-errors';
import * as methodOverride from "method-override";
import {static as eStatic, urlencoded} from "express";
import {engine} from "express-handlebars";
import {homeRouter} from "./routers/home";
import {warriorRouter} from "./routers/warrior";
import {arenaRouter} from "./routers/arena";
import {hallOfGloryRouter} from "./routers/hall-of-glory";
import {WarriorRecord} from "./records/warrior.record";
import './utils/db'
import {handleError} from "./utils/errors";
const app = express();
app.use(methodOverride('_method'));
app.use(urlencoded({
extended: true,
}));
app.use(eStatic('public'));
app.engine('.hbs', engine({
extname: '.hbs',
// helpers: ???
}));
app.set('view engine', '.hbs');
app.use(express.static(__dirname + '/views/img/'));
app.use('/', homeRouter);
app.use('/warrior', warriorRouter);
app.use('/arena', arenaRouter);
app.use('/hall-of-glory', hallOfGloryRouter);
app.use(handleError);
app.listen(3000, 'localhost', () => {
console.log(`Listening on http://localhost:3000`)
});
// const w = new WarriorRecord({
// name: 'Goku' ,
// strength: 7,
// defence: 1,
// stamina: 1,
// agility: 1,
// })
//
// console.log(w)