-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.ts
39 lines (32 loc) · 944 Bytes
/
app.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
import express,{Application} from 'express'
import helmet from 'helmet';
import nocache from 'nocache';
import compression from 'compression';
import logger from 'morgan';
import cors from 'cors';
import env from 'dotenv';
import grpcServer from './src/grpc-config/grpc-server';
class Server{
public app:Application
constructor(){
env.config()
this.app = express()
this.initialiseMiddleware()
this.initiliseGatewayListner()
}
private initialiseMiddleware():void{
this.app.use(cors())
this.app.use(helmet());
this.app.use(nocache())
this.app.use(compression())
this.app.use(logger('dev'))
this.app.use(express.json());
}
private initiliseGatewayListner():void{
grpcServer()
}
public start(port:string):void{
this.app.listen(port,()=>console.log(`auth service running at ${port}`))
}
}
export default Server