@polylith/server 0.1.5 → 0.1.6

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.
Files changed (2) hide show
  1. package/PolylithServer.js +11 -9
  2. package/package.json +1 -1
package/PolylithServer.js CHANGED
@@ -16,14 +16,15 @@ export class PolylithServer {
16
16
  this.root = workingDir();
17
17
  }
18
18
 
19
- getRouter(plApp) {
20
- if (plApp.router) {
21
- plApp.router(this.app);
22
- }
23
- }
19
+ async setAppRoutes(apps) {
20
+ for (let app of apps) {
21
+ var router = express.Router({mergeParams: true});
24
22
 
25
- watch(plApp) {
26
- plApp.watch();
23
+ var success = await app.router(router);
24
+ if (success) {
25
+ this.app.use(this.app.getRouterRoot(), router);
26
+ }
27
+ }
27
28
  }
28
29
 
29
30
  serve() {
@@ -34,7 +35,7 @@ export class PolylithServer {
34
35
  }, this)
35
36
  }
36
37
 
37
- create() {
38
+ async create() {
38
39
  var {
39
40
  https : httpsOptions,
40
41
  cors : corsOptions,
@@ -64,7 +65,8 @@ export class PolylithServer {
64
65
  .use(express.text())
65
66
  .use(express.raw())
66
67
 
67
- this.serve();
68
+ await this.setAppRoutes(apps);
69
+ this.serve();
68
70
 
69
71
  if (httpsOptions)
70
72
  this.server = https.createServer(httpsOptions, this.app);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polylith/server",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "This is the basic polylith http/https server. It is build on top of Express.js",
5
5
  "main": "index.js",
6
6
  "scripts": {