-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
40 lines (29 loc) · 894 Bytes
/
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
import * as bodyParser from "body-parser";
import express from "express";
import dotenv from 'dotenv';
import logger from "./logger";
import Routes from "./routes";
dotenv.config();
const port = process.env.PORT;
class App {
public express: express.Application;
constructor() {
this.express = express();
this.middleware();
this.routes();
}
private middleware(): void {
this.express.use(bodyParser.json());
this.express.use(bodyParser.urlencoded({ extended: false }));
}
private routes(): void {
this.express.get("/", (req, res, next) => {
res.send("Welcome to driver-did-ev");
});
this.express.use("/1.0", Routes);
this.express.listen(port, () => {
logger.info(`Server is running at https://localhost:${port}`);
});
}
}
export default new App().express;