@steedos/service-api 2.3.1 → 2.3.2-beta.3
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/index.js +32 -5
- package/package.json +4 -3
package/index.js
CHANGED
|
@@ -9,7 +9,7 @@ const {
|
|
|
9
9
|
// GraphQLTime,
|
|
10
10
|
GraphQLDateTime
|
|
11
11
|
} = require('graphql-iso-date');
|
|
12
|
-
|
|
12
|
+
const SteedosRouter = require('@steedos/router');
|
|
13
13
|
const _ = require('lodash');
|
|
14
14
|
|
|
15
15
|
/**
|
|
@@ -17,7 +17,6 @@ const _ = require('lodash');
|
|
|
17
17
|
* @typedef {import('http').IncomingMessage} IncomingRequest Incoming HTTP Request
|
|
18
18
|
* @typedef {import('http').ServerResponse} ServerResponse HTTP Server Response
|
|
19
19
|
*/
|
|
20
|
-
|
|
21
20
|
module.exports = {
|
|
22
21
|
name: "api",
|
|
23
22
|
mixins: [ApiGateway,
|
|
@@ -94,11 +93,13 @@ module.exports = {
|
|
|
94
93
|
|
|
95
94
|
// More info about settings: https://moleculer.services/docs/0.14/moleculer-web.html
|
|
96
95
|
settings: {
|
|
96
|
+
server: false,
|
|
97
|
+
|
|
97
98
|
// Exposed port
|
|
98
99
|
port: process.env.PORT || 3001,
|
|
99
100
|
|
|
100
101
|
// Exposed IP
|
|
101
|
-
ip: "0.0.0.0",
|
|
102
|
+
// ip: "0.0.0.0",
|
|
102
103
|
|
|
103
104
|
// Global Express middlewares. More info: https://moleculer.services/docs/0.14/moleculer-web.html#Middlewares
|
|
104
105
|
use: [],
|
|
@@ -116,7 +117,7 @@ module.exports = {
|
|
|
116
117
|
path: "/service/api",
|
|
117
118
|
|
|
118
119
|
whitelist: [
|
|
119
|
-
"**"
|
|
120
|
+
"**",
|
|
120
121
|
],
|
|
121
122
|
|
|
122
123
|
// Route-level Express middlewares. More info: https://moleculer.services/docs/0.14/moleculer-web.html#Middlewares
|
|
@@ -211,7 +212,6 @@ module.exports = {
|
|
|
211
212
|
},
|
|
212
213
|
|
|
213
214
|
methods: {
|
|
214
|
-
|
|
215
215
|
/**
|
|
216
216
|
* Authenticate the request. It check the `Authorization` token value in the request header.
|
|
217
217
|
* Check the token value & resolve the user by the token.
|
|
@@ -376,5 +376,32 @@ module.exports = {
|
|
|
376
376
|
};
|
|
377
377
|
},
|
|
378
378
|
|
|
379
|
+
},
|
|
380
|
+
created(){
|
|
381
|
+
this.app = SteedosRouter.staticRouter();
|
|
382
|
+
},
|
|
383
|
+
async started (){
|
|
384
|
+
|
|
385
|
+
this.broker.createService(require("@steedos/service-ui"));
|
|
386
|
+
|
|
387
|
+
// if (this.settings.server != true && this.settings.steedos_api_port){
|
|
388
|
+
// /* istanbul ignore next */
|
|
389
|
+
// await new this.Promise((resolve, reject) => {
|
|
390
|
+
// this.app.listen(this.settings.steedos_api_port, err => {
|
|
391
|
+
// if (err)
|
|
392
|
+
// return reject(err);
|
|
393
|
+
// this.logger.info(`Steedos Experience Server listening on ${this.settings.url}`);
|
|
394
|
+
// resolve();
|
|
395
|
+
// });
|
|
396
|
+
// });
|
|
397
|
+
// }
|
|
398
|
+
|
|
399
|
+
this.broker.waitForServices('~packages-@steedos/service-ui').then(()=>{
|
|
400
|
+
this.app.use("/", this.express());
|
|
401
|
+
})
|
|
402
|
+
|
|
403
|
+
global.SteedosApi = {
|
|
404
|
+
express: this.express
|
|
405
|
+
}
|
|
379
406
|
}
|
|
380
407
|
};
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steedos/service-api",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.2-beta.3",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@steedos/auth": "2.3.
|
|
7
|
+
"@steedos/auth": "2.3.2-beta.3",
|
|
8
|
+
"@steedos/service-ui": "2.3.2-beta.3",
|
|
8
9
|
"graphql": "^15.8.0",
|
|
9
10
|
"graphql-iso-date": "^3.6.1",
|
|
10
11
|
"graphql-type-json": "^0.3.2",
|
|
@@ -16,5 +17,5 @@
|
|
|
16
17
|
"publishConfig": {
|
|
17
18
|
"access": "public"
|
|
18
19
|
},
|
|
19
|
-
"gitHead": "
|
|
20
|
+
"gitHead": "1f337e8da176f1c75a8596b29ec7889eca996dc1"
|
|
20
21
|
}
|