forked from FreeCodeCamp-Chengdu/HOP-service
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBase.ts
More file actions
29 lines (24 loc) · 668 Bytes
/
Base.ts
File metadata and controls
29 lines (24 loc) · 668 Bytes
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
import { marked } from 'marked';
import { Controller, Get, HeaderParam, HttpCode } from 'routing-controllers';
import { isProduct } from '../utility';
@Controller()
export class BaseController {
static entryOf(host: string) {
host = 'http://' + host;
return `
- HTTP served at ${host}
- Swagger API served at ${host}/docs/
- Swagger API exposed at ${host}/docs/spec
${isProduct ? '' : `- Mock API served at ${host}/mock/`}
`;
}
@Get('/_health')
@HttpCode(200)
getHealthStatus() {
return '';
}
@Get()
getIndex(@HeaderParam('host') host: string) {
return marked(BaseController.entryOf(host));
}
}