oox 0.2.0 → 0.3.0-beta1
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/LICENSE +21 -21
- package/README.md +32 -29
- package/app.js +142 -0
- package/bin/argv.js +70 -95
- package/bin/cli.js +43 -58
- package/bin/configurer.js +49 -78
- package/bin/proxyer.js +61 -95
- package/bin/register.js +54 -105
- package/bin/starter.js +77 -144
- package/index.js +149 -6
- package/index.mjs +4 -0
- package/modules/http/index.js +180 -0
- package/modules/http/utils.js +73 -0
- package/modules/index.js +88 -0
- package/modules/module.js +16 -0
- package/modules/socketio/client.js +101 -0
- package/modules/socketio/index.js +148 -0
- package/modules/socketio/server.js +130 -0
- package/modules/socketio/socket.js +4 -0
- package/package.json +34 -16
- package/types/app.d.ts +37 -0
- package/types/bin/argv.d.ts +8 -0
- package/types/bin/cli.d.ts +2 -0
- package/types/bin/configurer.d.ts +1 -0
- package/types/bin/proxyer.d.ts +1 -0
- package/types/bin/register.d.ts +1 -0
- package/types/bin/starter.d.ts +1 -0
- package/types/index.d.ts +70 -0
- package/types/modules/http/index.d.ts +47 -0
- package/types/modules/http/utils.d.ts +17 -0
- package/types/modules/index.d.ts +23 -0
- package/types/modules/module.d.ts +11 -0
- package/types/modules/socketio/client.d.ts +23 -0
- package/types/modules/socketio/index.d.ts +35 -0
- package/types/modules/socketio/server.d.ts +35 -0
- package/types/modules/socketio/socket.d.ts +11 -0
- package/types/utils.d.ts +6 -0
- package/utils.js +63 -0
- package/.gitattributes +0 -2
- package/global.js +0 -118
- package/middleware.js +0 -167
- package/rpc/config.class.js +0 -48
- package/rpc/context.class.js +0 -15
- package/rpc/http.class.js +0 -312
- package/rpc/rpc.class.js +0 -231
- package/rpc/rpc.interface.class.js +0 -119
- package/rpc/socketio.class.js +0 -223
- package/service/service.class.js +0 -74
- package/service/socketio.class.js +0 -145
- package/setMap.class.js +0 -67
- package/socketio/client.class.js +0 -190
- package/socketio/server.class.js +0 -222
- package/socketio/socket.class.js +0 -23
- package/util.js +0 -224
package/bin/proxyer.js
CHANGED
|
@@ -1,95 +1,61 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
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
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const directory = path.resolve ( servicesDirectory )
|
|
64
|
-
|
|
65
|
-
const stat = fs.statSync ( directory )
|
|
66
|
-
|
|
67
|
-
if ( !stat.isDirectory ( ) ) throw new Error ( 'services must be directory' )
|
|
68
|
-
|
|
69
|
-
const subs = fs.readdirSync ( directory )
|
|
70
|
-
|
|
71
|
-
for ( const filename of subs ) {
|
|
72
|
-
|
|
73
|
-
const fullPath = path.resolve ( directory + path.sep + filename )
|
|
74
|
-
|
|
75
|
-
const stat = fs.statSync ( fullPath )
|
|
76
|
-
|
|
77
|
-
let id = '', name = ''
|
|
78
|
-
|
|
79
|
-
if ( stat.isDirectory ( ) && fs.existsSync ( fullPath + '/index.js' ) ) {
|
|
80
|
-
|
|
81
|
-
id = fullPath + '/index.js'
|
|
82
|
-
name = filename
|
|
83
|
-
} else if ( filename.endsWith ( '.js' ) ) {
|
|
84
|
-
|
|
85
|
-
id = fullPath
|
|
86
|
-
name = filename.split ( '.js' ) [ 0 ]
|
|
87
|
-
} else continue
|
|
88
|
-
|
|
89
|
-
if ( !excludes.includes ( name ) ) rewriteModuleCache ( id, dotCall ( name ) )
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
exports.setService = serviceClazz => Service = serviceClazz
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.proxyGroup = void 0;
|
|
4
|
+
const fs = require("node:fs");
|
|
5
|
+
const path = require("node:path");
|
|
6
|
+
const oox = require("../index");
|
|
7
|
+
const node_module_1 = require("node:module");
|
|
8
|
+
/**
|
|
9
|
+
* 重写 require 缓存
|
|
10
|
+
*/
|
|
11
|
+
function rewriteModuleCache(id, exports) {
|
|
12
|
+
const pathname = id.split(path.sep).slice(0, -1).join(path.sep);
|
|
13
|
+
const pathSplit = pathname.split(path.sep);
|
|
14
|
+
const paths = pathSplit.map((v, i, a) => a.slice(0, i + 1).concat('node_modules').join(path.sep)).reverse();
|
|
15
|
+
const m = new node_module_1.Module(id, null);
|
|
16
|
+
m.path = pathname;
|
|
17
|
+
m.exports = exports;
|
|
18
|
+
m.filename = m.id;
|
|
19
|
+
m.loaded = true;
|
|
20
|
+
m.children = [];
|
|
21
|
+
m.paths = paths;
|
|
22
|
+
require.cache[id] = m;
|
|
23
|
+
}
|
|
24
|
+
function dotCall(name, paths = []) {
|
|
25
|
+
return new Proxy(function () { }, {
|
|
26
|
+
get(target, key) {
|
|
27
|
+
return dotCall(name, paths.concat(key));
|
|
28
|
+
},
|
|
29
|
+
has(target, key) { return true; },
|
|
30
|
+
apply(target, thisArg, args) {
|
|
31
|
+
return oox.rpc(name, paths.join('.'), args);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function proxyGroup(groupDirectory, excludes = []) {
|
|
36
|
+
if (!groupDirectory)
|
|
37
|
+
return;
|
|
38
|
+
const directory = path.resolve(groupDirectory);
|
|
39
|
+
const stat = fs.statSync(directory);
|
|
40
|
+
if (!stat.isDirectory())
|
|
41
|
+
throw new Error('group must be directory');
|
|
42
|
+
const subs = fs.readdirSync(directory);
|
|
43
|
+
for (const filename of subs) {
|
|
44
|
+
const fullPath = path.resolve(directory + path.sep + filename);
|
|
45
|
+
const stat = fs.statSync(fullPath);
|
|
46
|
+
let id = '', name = '';
|
|
47
|
+
if (stat.isDirectory() && fs.existsSync(fullPath + '/index.js')) {
|
|
48
|
+
id = fullPath + '/index.js';
|
|
49
|
+
name = filename;
|
|
50
|
+
}
|
|
51
|
+
else if (filename.endsWith('.js')) {
|
|
52
|
+
id = fullPath;
|
|
53
|
+
name = filename.split('.js')[0];
|
|
54
|
+
}
|
|
55
|
+
else
|
|
56
|
+
continue;
|
|
57
|
+
if (!excludes.includes(name))
|
|
58
|
+
rewriteModuleCache(id, dotCall(name));
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.proxyGroup = proxyGroup;
|
package/bin/register.js
CHANGED
|
@@ -1,105 +1,54 @@
|
|
|
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
|
-
onConnection ( socket, service, url )
|
|
56
|
-
} catch ( error ) {
|
|
57
|
-
|
|
58
|
-
if ( !prevError ) console.log ( chalk.red`[Registry]`, chalk.underline.red`${url}`, 'error.' )
|
|
59
|
-
|
|
60
|
-
await delay ( 5000 )
|
|
61
|
-
|
|
62
|
-
connect ( service, url, error )
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
async function onConnection ( socket, service, url ) {
|
|
69
|
-
|
|
70
|
-
socket.on ( 'disconnect', async ( ) => {
|
|
71
|
-
|
|
72
|
-
console.log ( chalk.red`[Registry]`, chalk.underline.red`${url}`, 'disconnected.' )
|
|
73
|
-
|
|
74
|
-
await delay ( 1000 )
|
|
75
|
-
|
|
76
|
-
connect ( service, url )
|
|
77
|
-
} )
|
|
78
|
-
|
|
79
|
-
console.log ( chalk.green`[Registry]`, chalk.underline.green`${url}`, 'connected.' )
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
*
|
|
86
|
-
* @param {Service} service
|
|
87
|
-
* @param {String[]} registry
|
|
88
|
-
*/
|
|
89
|
-
exports.connect = async ( service, registry ) => {
|
|
90
|
-
|
|
91
|
-
if ( 'string' === typeof registry ) {
|
|
92
|
-
|
|
93
|
-
connect ( service, urlFormatter ( service, registry ) )
|
|
94
|
-
} else {
|
|
95
|
-
|
|
96
|
-
for ( const url of registry ) {
|
|
97
|
-
|
|
98
|
-
connect ( service, urlFormatter ( service, url ) )
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
exports.setService = serviceClazz => Service = serviceClazz
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registry = void 0;
|
|
4
|
+
const chalk_1 = require("chalk");
|
|
5
|
+
const oox = require("../index");
|
|
6
|
+
const delay = (ms) => new Promise(resolve => setTimeout(resolve, ms));
|
|
7
|
+
function urlFormatter(url) {
|
|
8
|
+
// :6000
|
|
9
|
+
if (url.startsWith(':'))
|
|
10
|
+
url = oox.config.host + url;
|
|
11
|
+
// http://127.0.0.1:6000
|
|
12
|
+
if (url.startsWith('http://'))
|
|
13
|
+
url = url.slice(7);
|
|
14
|
+
// 127.0.0.1:6000
|
|
15
|
+
if (!url.startsWith('ws://'))
|
|
16
|
+
url = 'ws://' + url;
|
|
17
|
+
const urlObject = new URL(url);
|
|
18
|
+
if (urlObject.pathname === '/' && !url.endsWith('/'))
|
|
19
|
+
url = url + '/socket.io';
|
|
20
|
+
return url;
|
|
21
|
+
}
|
|
22
|
+
async function connect(url, prevError = null) {
|
|
23
|
+
const { host } = oox.config;
|
|
24
|
+
const { port, path } = oox.modules.builtins.socketio.config;
|
|
25
|
+
if (`ws://${host}:${port}${path}` === url)
|
|
26
|
+
return;
|
|
27
|
+
try {
|
|
28
|
+
const socket = await oox.modules.builtins.socketio.connect(url);
|
|
29
|
+
onConnection(socket, url);
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
if (!prevError)
|
|
33
|
+
console.log((0, chalk_1.red) `[Registry]`, chalk_1.underline.red `${url}`, 'error.');
|
|
34
|
+
await delay(5000);
|
|
35
|
+
connect(url, error);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
async function onConnection(socket, url) {
|
|
39
|
+
const { name } = socket.data;
|
|
40
|
+
socket.on('disconnect', async () => {
|
|
41
|
+
console.log((0, chalk_1.red) `[Registry]`, `Service<${name}>`, chalk_1.underline.red `${url}`, 'disconnected.');
|
|
42
|
+
await delay(1000);
|
|
43
|
+
connect(url);
|
|
44
|
+
});
|
|
45
|
+
console.log((0, chalk_1.green) `[Registry]`, `Service<${name}>`, chalk_1.underline.green `${url}`, 'connected.');
|
|
46
|
+
}
|
|
47
|
+
async function registry(urls) {
|
|
48
|
+
if ('string' === typeof urls)
|
|
49
|
+
urls = [urls];
|
|
50
|
+
for (const url of urls) {
|
|
51
|
+
connect(urlFormatter(url));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.registry = registry;
|
package/bin/starter.js
CHANGED
|
@@ -1,144 +1,77 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const path = require
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
if (
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
return entry
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
exports.startup = async ( ) => {
|
|
84
|
-
|
|
85
|
-
// 加载环境变量
|
|
86
|
-
const env = configurer.configure ( )
|
|
87
|
-
|
|
88
|
-
Object.assign ( oox, env )
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
// 获取服务入口地址
|
|
93
|
-
const entryFile = getEntryFile ( env )
|
|
94
|
-
|
|
95
|
-
// 代理<服务间调用>
|
|
96
|
-
if ( env.group ) {
|
|
97
|
-
|
|
98
|
-
const excludes = [ entryFile.name ]
|
|
99
|
-
|
|
100
|
-
if ( Array.isArray ( env.ignore ) ) excludes.push ( ...env.ignore )
|
|
101
|
-
|
|
102
|
-
proxyer.proxyServices ( entryFile.group, excludes )
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// 加载服务
|
|
106
|
-
const entry = genEntry ( entryFile.name, entryFile.path, env.template )
|
|
107
|
-
|
|
108
|
-
proxyer.setService ( entry.constructor )
|
|
109
|
-
register.setService ( entry.constructor )
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
// 服务配置
|
|
114
|
-
if ( !env.port && !env.http && !env.socketio ) env.port = 0
|
|
115
|
-
|
|
116
|
-
if ( 'number' === typeof env.port ) {
|
|
117
|
-
|
|
118
|
-
if ( !entry.http.config ) entry.http.config = { }
|
|
119
|
-
if ( !entry.socketio.config ) entry.socketio.config = { }
|
|
120
|
-
|
|
121
|
-
entry.http.config.port =
|
|
122
|
-
entry.socketio.config.port = env.port
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
if ( 'http' in env ) entry.http.config = env.http
|
|
126
|
-
|
|
127
|
-
if ( 'socketio' in env ) entry.socketio.config = env.socketio
|
|
128
|
-
|
|
129
|
-
if ( env.origin ) entry.config.origin = env.origin
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
// 服务启动
|
|
134
|
-
await entry.serve ( )
|
|
135
|
-
|
|
136
|
-
console.log ( )
|
|
137
|
-
console.log ( 'Service', chalk.bold`${entry.name}`, 'running.' )
|
|
138
|
-
if ( entry.http.config ) console.log ( ' at', chalk.underline.green`http://${entry.config.host}:${entry.http.config.port}${entry.http.config.path}` )
|
|
139
|
-
if ( entry.socketio.config ) console.log ( ' at', chalk.underline.green`ws://${entry.config.host}:${entry.socketio.config.port}${entry.socketio.config.path}` )
|
|
140
|
-
console.log ( )
|
|
141
|
-
|
|
142
|
-
// 服务注册
|
|
143
|
-
if ( env.registry ) register.connect ( entry, env.registry )
|
|
144
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.startup = void 0;
|
|
4
|
+
const path = require("node:path");
|
|
5
|
+
const chalk_1 = require("chalk");
|
|
6
|
+
const oox = require("../index");
|
|
7
|
+
const proxyer_1 = require("./proxyer");
|
|
8
|
+
const configurer_1 = require("./configurer");
|
|
9
|
+
const register_1 = require("./register");
|
|
10
|
+
function getEntryFile(env) {
|
|
11
|
+
const args = process.argv.slice(2);
|
|
12
|
+
var [entryFilename] = args.filter(arg => !arg.includes('=') && arg.endsWith('.js'));
|
|
13
|
+
if (!entryFilename)
|
|
14
|
+
throw new Error('Cannot find entry file');
|
|
15
|
+
const fullPath = path.resolve(entryFilename);
|
|
16
|
+
const filename = path.basename(fullPath);
|
|
17
|
+
const fullDirectory = path.dirname(fullPath);
|
|
18
|
+
const directory = fullDirectory.split(path.sep).pop();
|
|
19
|
+
const groupFullDirectory = env.group ? path.resolve(env.group) : '';
|
|
20
|
+
var name = filename === 'index.js' && groupFullDirectory !== fullDirectory ? directory : filename.split('.js')[0];
|
|
21
|
+
return { name, path: fullPath, group: groupFullDirectory };
|
|
22
|
+
}
|
|
23
|
+
function loadEntry(name, entryPath) {
|
|
24
|
+
oox.config.name = name;
|
|
25
|
+
const methods = require(entryPath);
|
|
26
|
+
oox.setMethods(methods);
|
|
27
|
+
}
|
|
28
|
+
async function startup() {
|
|
29
|
+
// 加载环境变量
|
|
30
|
+
const env = (0, configurer_1.configure)();
|
|
31
|
+
Object.assign(oox.config, env);
|
|
32
|
+
// 获取服务入口地址
|
|
33
|
+
const entryFile = getEntryFile(env);
|
|
34
|
+
// 代理<服务间调用>
|
|
35
|
+
if (env.group) {
|
|
36
|
+
const excludes = [entryFile.name];
|
|
37
|
+
if (Array.isArray(env.ignore))
|
|
38
|
+
excludes.push(...env.ignore);
|
|
39
|
+
(0, proxyer_1.proxyGroup)(entryFile.group, excludes);
|
|
40
|
+
}
|
|
41
|
+
// 加载服务
|
|
42
|
+
loadEntry(entryFile.name, entryFile.path);
|
|
43
|
+
// 服务配置
|
|
44
|
+
if (!env.port && !env.http && !env.socketio)
|
|
45
|
+
env.port = 0;
|
|
46
|
+
const httpConfig = oox.modules.builtins.http.config, socketioConfig = oox.modules.builtins.socketio.config;
|
|
47
|
+
if ('number' === typeof env.port) {
|
|
48
|
+
httpConfig.port = socketioConfig.port = env.port;
|
|
49
|
+
}
|
|
50
|
+
if (env.origin)
|
|
51
|
+
httpConfig.origin = env.origin;
|
|
52
|
+
if ('http' in env) {
|
|
53
|
+
if (env.http)
|
|
54
|
+
Object.assign(httpConfig, env.http);
|
|
55
|
+
else
|
|
56
|
+
httpConfig.disabled = true;
|
|
57
|
+
}
|
|
58
|
+
if ('socketio' in env) {
|
|
59
|
+
if (env.socketio)
|
|
60
|
+
Object.assign(socketioConfig, env.socketio);
|
|
61
|
+
else
|
|
62
|
+
socketioConfig.disabled = true;
|
|
63
|
+
}
|
|
64
|
+
// 服务启动
|
|
65
|
+
await oox.serve();
|
|
66
|
+
console.log();
|
|
67
|
+
console.log('Service', (0, chalk_1.bold) `${oox.config.name}`, 'running.');
|
|
68
|
+
if (!httpConfig.disabled)
|
|
69
|
+
console.log(' at', chalk_1.underline.green `http://${oox.config.host}:${httpConfig.port}${httpConfig.path}`);
|
|
70
|
+
if (!socketioConfig.disabled)
|
|
71
|
+
console.log(' at', chalk_1.underline.green `ws://${oox.config.host}:${socketioConfig.port}${socketioConfig.path}`);
|
|
72
|
+
console.log();
|
|
73
|
+
// 服务注册
|
|
74
|
+
if (env.registry)
|
|
75
|
+
(0, register_1.registry)(env.registry);
|
|
76
|
+
}
|
|
77
|
+
exports.startup = startup;
|