-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.ts
56 lines (45 loc) · 3.91 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
53
54
55
56
import bodyparser from 'body-parser';
import express, { Express, Request, Response } from "express"
import cors from 'cors';
import fileUpload from 'express-fileupload';
import dotenv from "dotenv"
import cookieParser from 'cookie-parser';
import { loggingMiddleware } from './src/util/logger/logging';
import { initMysql } from './src/util/mysql/mysql';
import { initMongo } from './src/util/mongodb/mongodb';
import { config } from 'src/config/config';
import { initRabbitMQ } from './src/util/rabbitmq/rabbitmq';
import { DomainController } from '@adapter_in/rest/domain/controller/controller';
const app: Express = express()
const port = config.app.appPort
const apiVersion = config.app.apiVersion
const appName = config.app.appName
dotenv.config()
app.use(bodyparser.json())
app.use(cors())
app.use(fileUpload())
app.use(cookieParser())
app.use(loggingMiddleware)
// Init configuration
// initMysql()
// initMongo()
// initRabbitMQ()
const domainController = new DomainController(app, apiVersion)
domainController.init()
app.get('/', (_: Request, res: Response) => {
res.send(`
<div style="display: flex; justify-content: center; align-items: center; height: 100vh;">
<pre>
██╗ ██╗███████╗██╗ ██╗ █████╗ ██████╗ ██████╗ ███╗ ██╗ █████╗ ██╗ ██████╗ ██████╗ ██╗██╗ ███████╗██████╗ ██████╗ ██╗ █████╗ ████████╗███████╗
██║ ██║██╔════╝╚██╗██╔╝██╔══██╗██╔════╝ ██╔═══██╗████╗ ██║██╔══██╗██║ ██╔══██╗██╔═══██╗██║██║ ██╔════╝██╔══██╗██╔══██╗██║ ██╔══██╗╚══██╔══╝██╔════╝
███████║█████╗ ╚███╔╝ ███████║██║ ███╗██║ ██║██╔██╗ ██║███████║██║ ██████╔╝██║ ██║██║██║ █████╗ ██████╔╝██████╔╝██║ ███████║ ██║ █████╗
██╔══██║██╔══╝ ██╔██╗ ██╔══██║██║ ██║██║ ██║██║╚██╗██║██╔══██║██║ ██╔══██╗██║ ██║██║██║ ██╔══╝ ██╔══██╗██╔═══╝ ██║ ██╔══██║ ██║ ██╔══╝
██║ ██║███████╗██╔╝ ██╗██║ ██║╚██████╔╝╚██████╔╝██║ ╚████║██║ ██║███████╗ ██████╔╝╚██████╔╝██║███████╗███████╗██║ ██║██║ ███████╗██║ ██║ ██║ ███████╗
╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═╝╚══════╝ ╚═════╝ ╚═════╝ ╚═╝╚══════╝╚══════╝╚═╝ ╚═╝╚═╝ ╚══════╝╚═╝ ╚═╝ ╚═╝ ╚══════╝
</pre>
</div>
`)
})
app.listen(port, () => {
console.log(`${appName} is listening on port ${port}`)
})