samanbayaka 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +97 -0
- package/bash/sbk.sh +11 -0
- package/config/broker.mjs +159 -0
- package/config/kafkajs.mjs +54 -0
- package/config/logger.mjs +35 -0
- package/config/nats.mjs +26 -0
- package/config/server.mjs +26 -0
- package/gateway.mjs +140 -0
- package/helper/file/esm-loading.mjs +181 -0
- package/helper/transporter/RedpandaTransporter.mjs +235 -0
- package/helper/transporter/RedpandaTransporter.mjs.bk +230 -0
- package/helper/transporter/rpk-commands.txt +8 -0
- package/helper/utility/format-errors.mjs +72 -0
- package/helper/utility/node-argv.mjs +55 -0
- package/helper/validator/AjvValidator.mjs +65 -0
- package/index-argv.mjs +92 -0
- package/index.mjs +121 -0
- package/metrics.mjs +49 -0
- package/package.json +43 -0
- package/package.json.bk +32 -0
- package/pnpm-workspace.yaml +2 -0
- package/public/favicon.ico +0 -0
- package/public/favicon.svg +30 -0
- package/public/favicon2.ico +0 -0
- package/public/index.html +115 -0
- package/public/scalar/js/standalone.js +44 -0
- package/public/scalar.html +28 -0
- package/samanbayaka-0.0.1.tgz +0 -0
- package/services/gateway/index.mjs +136 -0
- package/services/mail/index.mjs +12 -0
- package/services/sms/index.mjs +16 -0
- package/services/system/openapi.mjs +49 -0
- package/services/system/scalar.mjs +31 -0
- package/services/system/sw-stats-mw.mjs +12 -0
- package/services/system/system.service.mjs +212 -0
- package/services/tst/index.mjs +67 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>Scalar API Reference</title>
|
|
5
|
+
<meta charset="utf-8" />
|
|
6
|
+
<meta
|
|
7
|
+
name="viewport"
|
|
8
|
+
content="width=device-width, initial-scale=1" />
|
|
9
|
+
</head>
|
|
10
|
+
|
|
11
|
+
<body>
|
|
12
|
+
<div id="app"></div>
|
|
13
|
+
|
|
14
|
+
<!-- Load the Script -->
|
|
15
|
+
<script src="./js/scalar.js"></script>
|
|
16
|
+
|
|
17
|
+
<!-- Initialize the Scalar API Reference -->
|
|
18
|
+
<script>
|
|
19
|
+
Scalar.createApiReference('#app', {
|
|
20
|
+
// The URL of the OpenAPI/Swagger document
|
|
21
|
+
// url: 'http://localhost:8765/sbk/system/openapi.json?format=json',
|
|
22
|
+
// Avoid CORS issues
|
|
23
|
+
proxyUrl: 'https://proxy.scalar.com',
|
|
24
|
+
})
|
|
25
|
+
</script>
|
|
26
|
+
</body>
|
|
27
|
+
</html>
|
|
28
|
+
|
|
Binary file
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/*index.mjs*/
|
|
2
|
+
import path from "path"
|
|
3
|
+
import url from "url"
|
|
4
|
+
|
|
5
|
+
import ApiGateway from "moleculer-web"
|
|
6
|
+
import OpenApi from "moleculer-auto-openapi"
|
|
7
|
+
import cookieParser from "cookie-parser"
|
|
8
|
+
import helmet from "helmet"
|
|
9
|
+
import compression from "compression"
|
|
10
|
+
|
|
11
|
+
import {getConfig, assetPath} from '#hFil/esm-loading.mjs'
|
|
12
|
+
import {formatApiGwErrors} from '#hUti/format-errors.mjs'
|
|
13
|
+
|
|
14
|
+
const CONFIG = await getConfig('server')
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
export default {
|
|
18
|
+
name: "gateway",
|
|
19
|
+
mixins: [
|
|
20
|
+
ApiGateway,
|
|
21
|
+
],
|
|
22
|
+
|
|
23
|
+
settings: {
|
|
24
|
+
port: CONFIG.PORT,
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Middleware mode (for ExpressJS)
|
|
28
|
+
*/
|
|
29
|
+
middleware: false,
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Exposed global path prefix
|
|
33
|
+
*/
|
|
34
|
+
path: "/sbk",
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Global middlewares. Applied to all routes.
|
|
38
|
+
*/
|
|
39
|
+
use: [
|
|
40
|
+
compression(),
|
|
41
|
+
cookieParser(),
|
|
42
|
+
helmet(),
|
|
43
|
+
],
|
|
44
|
+
|
|
45
|
+
cors: {
|
|
46
|
+
methods: ["DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT"],
|
|
47
|
+
origin: "*",
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
routes: [
|
|
52
|
+
/**
|
|
53
|
+
* API routes
|
|
54
|
+
*/
|
|
55
|
+
{
|
|
56
|
+
path: "/api",
|
|
57
|
+
whitelist: [
|
|
58
|
+
/**
|
|
59
|
+
* Access any actions except 'system' service
|
|
60
|
+
*/
|
|
61
|
+
/^(?!(gateway|system)\.)\w+(?:\.\w+)*$/
|
|
62
|
+
],
|
|
63
|
+
autoAliases: true,
|
|
64
|
+
mergeParams: false,
|
|
65
|
+
mappingPolicy: "restrict",
|
|
66
|
+
logging: true,
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Use bodyparser module
|
|
70
|
+
*/
|
|
71
|
+
bodyParsers: {
|
|
72
|
+
json: true,
|
|
73
|
+
urlencoded: { extended: true }
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
// /**
|
|
80
|
+
// * Logging request parameters with 'info' level
|
|
81
|
+
// */
|
|
82
|
+
logRequestParams: null,
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
// /**
|
|
86
|
+
// * Logging response data with 'debug' level
|
|
87
|
+
// */
|
|
88
|
+
logResponseData: false,
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* global assets location
|
|
93
|
+
*/
|
|
94
|
+
assets: {
|
|
95
|
+
/**
|
|
96
|
+
* Root folder of assets
|
|
97
|
+
*/
|
|
98
|
+
folder: assetPath.rootFolder,
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Further options to `serve-static` module
|
|
102
|
+
*/
|
|
103
|
+
options: {}
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Global error handler
|
|
109
|
+
*/
|
|
110
|
+
onError(req, res, err) {
|
|
111
|
+
|
|
112
|
+
formatApiGwErrors(req, res, err)
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Custom logging
|
|
116
|
+
*/
|
|
117
|
+
this.logResponse(req, res)
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
},
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
methods: {
|
|
125
|
+
/**
|
|
126
|
+
* This overrides the errorHandler method found in the official file
|
|
127
|
+
*/
|
|
128
|
+
errorHandler(req, res, err) {
|
|
129
|
+
// // don't log client side errors unless it's configured
|
|
130
|
+
// if (this.settings.log4XXResponses || (err && !_.inRange(err.code, 400, 500))) {
|
|
131
|
+
// this.logger.error(" Request error!", err.name, ":", err.message, "\n", err.stack, "\nData:", err.data);
|
|
132
|
+
// }
|
|
133
|
+
this.sendError(req, res, err)
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*index.mjs*/
|
|
2
|
+
import { Errors } from "moleculer"
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
name: "sms",
|
|
7
|
+
// version: "v1",
|
|
8
|
+
|
|
9
|
+
events: {
|
|
10
|
+
"user.created"(payload) {
|
|
11
|
+
this.logger.info("User created SMS sent:", payload)
|
|
12
|
+
// throw new Errors.MoleculerError('fffffff',500,'XXX')
|
|
13
|
+
// throw new Error('jjjjjjj')
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/*openapi.mjs*/
|
|
2
|
+
import { readFileSync } from "fs";
|
|
3
|
+
import { fileURLToPath } from "url";
|
|
4
|
+
import * as path from "path"
|
|
5
|
+
|
|
6
|
+
import CONFIG from "../../config/server.config.mjs"
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
const __filename = fileURLToPath(import.meta.url)
|
|
10
|
+
const __dirname = path.dirname(__filename)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Read package.json and convert to object
|
|
15
|
+
* @type {object}
|
|
16
|
+
*/
|
|
17
|
+
const pkg = JSON.parse(readFileSync(path.join(__dirname, "../../package.json"), "utf8"))
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Create and object of name and version
|
|
21
|
+
* @type {Object}
|
|
22
|
+
*/
|
|
23
|
+
const pkgProjDtls = {
|
|
24
|
+
name: pkg.name.split('-')[0]
|
|
25
|
+
.split(" ")
|
|
26
|
+
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
|
|
27
|
+
.join(" "),
|
|
28
|
+
version: pkg.version
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* OpenAPI configuration
|
|
34
|
+
*/
|
|
35
|
+
export default {
|
|
36
|
+
info: {
|
|
37
|
+
title: pkgProjDtls.name,
|
|
38
|
+
version: pkgProjDtls.version,
|
|
39
|
+
summary: 'ESB',
|
|
40
|
+
description: "An API Gateway service provider.",
|
|
41
|
+
},
|
|
42
|
+
servers: CONFIG.URL_SERVERS,
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export default (port)=>{
|
|
2
|
+
return `
|
|
3
|
+
<!doctype html>
|
|
4
|
+
<html>
|
|
5
|
+
<head>
|
|
6
|
+
<title>Scalar API Reference</title>
|
|
7
|
+
<meta charset="utf-8" />
|
|
8
|
+
<meta
|
|
9
|
+
name="viewport"
|
|
10
|
+
content="width=device-width, initial-scale=1" />
|
|
11
|
+
</head>
|
|
12
|
+
|
|
13
|
+
<body>
|
|
14
|
+
<div id="app"></div>
|
|
15
|
+
|
|
16
|
+
<!-- Load the Script -->
|
|
17
|
+
<script src="../../../scalar/js/standalone.js"></script>
|
|
18
|
+
|
|
19
|
+
<!-- Initialize the Scalar API Reference -->
|
|
20
|
+
<script>
|
|
21
|
+
Scalar.createApiReference('#app', {
|
|
22
|
+
// The URL of the OpenAPI/Swagger document
|
|
23
|
+
url: window.location.origin + '/sbk/system/openapi.json?format=json',
|
|
24
|
+
// Avoid CORS issues
|
|
25
|
+
proxyUrl: 'https://proxy.scalar.com',
|
|
26
|
+
})
|
|
27
|
+
</script>
|
|
28
|
+
</body>
|
|
29
|
+
</html>
|
|
30
|
+
`
|
|
31
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*sw-stats-mw.mjs*/
|
|
2
|
+
import swStats from "swagger-stats"
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Swagger-stats middleware to collects and exposes API statistics, metrics, and monitoring dashboards for REST APIs
|
|
6
|
+
*/
|
|
7
|
+
export default(path)=>{
|
|
8
|
+
return swStats.getMiddleware({
|
|
9
|
+
uriPath: path,
|
|
10
|
+
swaggerSpec: null, // we'll inject the spec later
|
|
11
|
+
})
|
|
12
|
+
}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
/*api.sevices.mjs*/
|
|
2
|
+
import ApiGateway from "moleculer-web"
|
|
3
|
+
import OpenApi from "moleculer-auto-openapi"
|
|
4
|
+
|
|
5
|
+
import cookieParser from "cookie-parser"
|
|
6
|
+
import helmet from "helmet"
|
|
7
|
+
|
|
8
|
+
import CONFIG from "../../config/server.config.mjs"
|
|
9
|
+
import openApi from "./openapi.mjs"
|
|
10
|
+
import assetPath from "./assets.mjs"
|
|
11
|
+
import scalarHTML from "./scalar.mjs"
|
|
12
|
+
import swStatsMw from "./sw-stats-mw.mjs"
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
export default {
|
|
16
|
+
name: "system",
|
|
17
|
+
mixins: [
|
|
18
|
+
ApiGateway,
|
|
19
|
+
OpenApi
|
|
20
|
+
],
|
|
21
|
+
|
|
22
|
+
settings: {
|
|
23
|
+
port: 8089,
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Global middlewares. Applied to all routes.
|
|
27
|
+
*/
|
|
28
|
+
use: [
|
|
29
|
+
// cookieParser(),
|
|
30
|
+
// helmet(),
|
|
31
|
+
swStatsMw(CONFIG.SW_STATS_RT),
|
|
32
|
+
],
|
|
33
|
+
|
|
34
|
+
cors: {
|
|
35
|
+
methods: ["DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT"],
|
|
36
|
+
origin: "*",
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
routes: [
|
|
40
|
+
/**
|
|
41
|
+
* System routes
|
|
42
|
+
*/
|
|
43
|
+
{
|
|
44
|
+
path: "/sbk/system",
|
|
45
|
+
whitelist: [
|
|
46
|
+
/**
|
|
47
|
+
* Access any actions in 'system' service
|
|
48
|
+
*/
|
|
49
|
+
/^system\.\w+$/
|
|
50
|
+
],
|
|
51
|
+
mappingPolicy: "restrict",
|
|
52
|
+
autoAliases: true,
|
|
53
|
+
mergeParams: false,
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* API routes
|
|
58
|
+
*/
|
|
59
|
+
{
|
|
60
|
+
path: "/sbk/api",
|
|
61
|
+
whitelist: [
|
|
62
|
+
/**
|
|
63
|
+
* Access any actions except 'system' service
|
|
64
|
+
*/
|
|
65
|
+
/^(?!(system|gateway)\.)\w+(?:\.\w+)*$/
|
|
66
|
+
],
|
|
67
|
+
autoAliases: true,
|
|
68
|
+
mergeParams: false,
|
|
69
|
+
mappingPolicy: "restrict",
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* global assets location
|
|
76
|
+
*/
|
|
77
|
+
assets: {
|
|
78
|
+
/**
|
|
79
|
+
* Root folder of assets
|
|
80
|
+
*/
|
|
81
|
+
folder: assetPath.publicPath,
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Further options to `serve-static` module
|
|
85
|
+
*/
|
|
86
|
+
options: {}
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* OpenAPI configuration
|
|
92
|
+
*/
|
|
93
|
+
openapi: openApi,
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* moleculer openapi-auto-openapi settings
|
|
97
|
+
*/
|
|
98
|
+
schemaPath: "/sbk/system/openapi.json",
|
|
99
|
+
assetsPath: "/sbk/system/swagger/assets",
|
|
100
|
+
uiPath: "/sbk/system/swagger/docs-ui",
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
actions: {
|
|
105
|
+
molActions(ctx){
|
|
106
|
+
return ctx.call("$node.actions")
|
|
107
|
+
},
|
|
108
|
+
|
|
109
|
+
openApiSpec(ctx){
|
|
110
|
+
return ctx.call("system.generateDocs")
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
async scalarUi(ctx){
|
|
114
|
+
/**
|
|
115
|
+
* set Content-Type header for the API Gateway response
|
|
116
|
+
*/
|
|
117
|
+
ctx.meta.$responseType = "text/html charset=utf-8"
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* return raw HTML string (will be sent as response body)
|
|
121
|
+
*/
|
|
122
|
+
return scalarHTML(CONFIG.PORT)
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Serve Swagger-stats UI directly in browser
|
|
127
|
+
*/
|
|
128
|
+
async swStatsUi(ctx) {
|
|
129
|
+
ctx.meta.$statusCode = 302 // HTTP redirect
|
|
130
|
+
ctx.meta.$responseHeaders = {
|
|
131
|
+
Location: `/sbk/system${CONFIG.SW_STATS_RT}/index.html`
|
|
132
|
+
}
|
|
133
|
+
return "Redirecting..."
|
|
134
|
+
},
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Serve Redpanda UI directly in browser
|
|
138
|
+
*/
|
|
139
|
+
async redpandaUi(ctx) {
|
|
140
|
+
ctx.meta.$statusCode = 302 // HTTP redirect
|
|
141
|
+
ctx.meta.$responseHeaders = {
|
|
142
|
+
Location: CONFIG.URL_REDPANDA_WEB_UI
|
|
143
|
+
}
|
|
144
|
+
return "Redirecting..."
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* swagger-stats initialized with OpenAPI spec once the Gateway service started.
|
|
150
|
+
*/
|
|
151
|
+
async started() {
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Generate spec after service starts
|
|
155
|
+
*/
|
|
156
|
+
const spec = await this.actions.generateDocs()
|
|
157
|
+
|
|
158
|
+
/*Patch swagger-stats middleware with spec*/
|
|
159
|
+
const swStats = this.settings.use.find(mw => mw.name === "swagger-stats")
|
|
160
|
+
if (swStats && spec) {
|
|
161
|
+
swStats.swaggerSpec = spec
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* add endpoints
|
|
166
|
+
*/
|
|
167
|
+
this.addRoute({
|
|
168
|
+
path: "/sbk/system",
|
|
169
|
+
aliases: {
|
|
170
|
+
/**
|
|
171
|
+
* Actions list
|
|
172
|
+
*/
|
|
173
|
+
"GET /mol/actions": "system.molActions",
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Aliases list
|
|
177
|
+
*/
|
|
178
|
+
"GET /mol/aliases": "system.listAliases",
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* OpenAPI spec
|
|
182
|
+
*/
|
|
183
|
+
"GET /openapi.json": "system.openApiSpec",
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Swagger docs-ui
|
|
187
|
+
*/
|
|
188
|
+
"GET /swagger-ui": "system.ui",
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Swagger assets
|
|
192
|
+
*/
|
|
193
|
+
"GET /swagger/assets/:file": "system.assets",
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* swagger stats ui
|
|
197
|
+
*/
|
|
198
|
+
"GET /telemetry": "system.swStatsUi",
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Scalar UI
|
|
202
|
+
*/
|
|
203
|
+
"GET /scalar": "system.scalarUi",
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Redirect to redpanda web client
|
|
207
|
+
*/
|
|
208
|
+
"GET /redpanda": "system.redpandaUi",
|
|
209
|
+
}
|
|
210
|
+
})
|
|
211
|
+
},
|
|
212
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/*index.mjs*/
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
name: "tst",
|
|
5
|
+
// version: "v1",
|
|
6
|
+
|
|
7
|
+
actions: {
|
|
8
|
+
hello: {
|
|
9
|
+
rest: {
|
|
10
|
+
method: "GET",
|
|
11
|
+
path: "/hello"
|
|
12
|
+
},
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Enable caching to this action
|
|
16
|
+
*/
|
|
17
|
+
cache: {
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* These cache entries will be expired after 5 seconds instead of 30.
|
|
21
|
+
*/
|
|
22
|
+
ttl: 2*60
|
|
23
|
+
},
|
|
24
|
+
handler(ctx){
|
|
25
|
+
return "Hello Moleculer krish!"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
welcome: {
|
|
29
|
+
rest: "GET /welcome",
|
|
30
|
+
handler(ctx) {
|
|
31
|
+
// console.log(ctx)
|
|
32
|
+
JSON.parse('{"ff":aa')
|
|
33
|
+
return `Welcome, ${ctx.params.query.name || " Guest1234"}--${ctx.broker.nodeID}`
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
// createUser
|
|
37
|
+
},
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
// "GET hello": "greeter.hello",
|
|
42
|
+
// "GET welcome": "greeter.welcome",
|
|
43
|
+
// "GET hello/:name": "greeter.abc"
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
// actions: {
|
|
47
|
+
// redirectStatsUI: {
|
|
48
|
+
// rest: { method: "GET", path: "/swagger/stats-ui/abc" },
|
|
49
|
+
// openapi: {
|
|
50
|
+
// summary: "Redirect to Swagger Stats UI",
|
|
51
|
+
// tags: ["system"]
|
|
52
|
+
// },
|
|
53
|
+
// async handler(ctx) {
|
|
54
|
+
// ctx.meta.$responseType = "text/html"
|
|
55
|
+
// return readFileSync(path.join(require.resolve("swagger-stats"), "../../ux/index.html"), "utf8")
|
|
56
|
+
// }
|
|
57
|
+
// }
|
|
58
|
+
// },
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
// // 🔹 Redirect to redpanda web client
|
|
62
|
+
// "GET /redpanda": (req, res)=>{
|
|
63
|
+
// res.writeHead(302, {
|
|
64
|
+
// Location: CONFIG.URL_REDPANDA_WEB_UI
|
|
65
|
+
// });
|
|
66
|
+
// res.end()
|
|
67
|
+
// },
|