-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.ts
More file actions
48 lines (41 loc) · 1.42 KB
/
app.ts
File metadata and controls
48 lines (41 loc) · 1.42 KB
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
import cookieParser from 'cookie-parser';
import { Application } from 'express';
import { logger } from './src/config/winston';
const dotenv = require('dotenv');
const express = require('express');
const fileUpload = require('express-fileupload');
const methodOverride = require('method-override');
const morgan = require('morgan');
class App {
app: Application;
constructor() {
this.app = express();
this.app.use(fileUpload());
dotenv.config();
this.setMiddleWare();
this.getRouting();
}
setMiddleWare() {
this.app.use(morgan('default', { stream: logger.stream })); // morgan 로그 설정
this.app.use(express.json());
this.app.use(express.urlencoded({ extended: false }));
this.app.use(methodOverride());
this.app.use(cookieParser());
this.app.disable('x-powered-by');
this.app.set('trust proxy', true);
this.app.set('case sensitive routing', true);
this.app.set('strict routing', true);
this.app.set('etag', 'strong');
this.app.set('x-powered-by', false);
this.app.set('view cache', true);
this.app.set('view engine', 'pug');
}
getRouting() {
this.app.use('/toki-api', require('~/api/analyze'));
this.app.use('/toki-api', require('~/api/auth'));
this.app.use('/toki-api', require('~/api/user'));
this.app.use('/toki-api', require('~/api/ranking'));
this.app.use('/toki-api', require('~/api/table'));
}
}
module.exports = new App().app;