-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
39 lines (32 loc) · 918 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
/* eslint-disable import/no-unresolved */
/* eslint-disable import/extensions */
import express from 'express';
import compression from 'compression';
import cors from 'cors';
import AuthRoutes from './routes/authRoutes';
class Shuttle {
public app: express.Application;
constructor() {
this.app = express();
this.config();
this.routes();
}
public config() {
this.app.set('port', process.env.port || 3000);
this.app.use(express.json());
this.app.use(express.urlencoded({ extended: false }));
this.app.use(compression());
this.app.use(cors());
}
public routes() {
this.app.use('/auth', new AuthRoutes().router);
}
public start() {
const port = this.app.get('port');
this.app.listen(port, () => {
console.log(`App listening on PORT ${port}`);
});
}
}
const server = new Shuttle();
server.start();