-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathapp.js
More file actions
24 lines (24 loc) · 824 Bytes
/
app.js
File metadata and controls
24 lines (24 loc) · 824 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
'use strict';
const grpcServer = require('./libs');
const assert = require('assert');
module.exports = app => {
app.beforeStart(async () => {
const config = app.config.grpcServer;
assert(
config != null,
'[egg-grpc-server] no grpcServer options in config file! '
);
assert(
config.protoDir &&
config.serviceDir &&
config.host &&
config.port &&
config.loaderOptions,
`[egg-grpc-server] please check config file . protoDir:${config.protoDir} serviceDir:${config.serviceDir} host:${config.host} port:${config.port} loaderOptions:${config.loaderOptions}`
);
if (config.app === true) {
app.logger.info('[egg-grpc-server] grpc server will be loaded on app.js');
app.grpcServer = await new grpcServer(app).init();
}
});
};