@webtypen/webframez-core 0.0.12 → 0.0.13
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/lib/Router/Router.d.ts +5 -1
- package/lib/Router/Router.js +9 -1
- package/package.json +1 -1
- package/src/Router/Router.ts +12 -1
package/lib/Router/Router.d.ts
CHANGED
|
@@ -9,6 +9,10 @@ type RouteObject = {
|
|
|
9
9
|
params: object;
|
|
10
10
|
};
|
|
11
11
|
declare class RouterFacade {
|
|
12
|
+
/**
|
|
13
|
+
* Basename
|
|
14
|
+
*/
|
|
15
|
+
basename: string | null;
|
|
12
16
|
/**
|
|
13
17
|
* GET Route Store
|
|
14
18
|
*/
|
|
@@ -57,7 +61,7 @@ declare class RouterFacade {
|
|
|
57
61
|
* Load the application-routes
|
|
58
62
|
*
|
|
59
63
|
*/
|
|
60
|
-
init(): void;
|
|
64
|
+
init(options?: any): void;
|
|
61
65
|
/**
|
|
62
66
|
* Register a route
|
|
63
67
|
*
|
package/lib/Router/Router.js
CHANGED
|
@@ -19,6 +19,10 @@ const Response_1 = require("./Response");
|
|
|
19
19
|
const Kernel_1 = require("../../../../../app/Kernel");
|
|
20
20
|
class RouterFacade {
|
|
21
21
|
constructor() {
|
|
22
|
+
/**
|
|
23
|
+
* Basename
|
|
24
|
+
*/
|
|
25
|
+
this.basename = null;
|
|
22
26
|
/**
|
|
23
27
|
* GET Route Store
|
|
24
28
|
*/
|
|
@@ -40,7 +44,8 @@ class RouterFacade {
|
|
|
40
44
|
* Load the application-routes
|
|
41
45
|
*
|
|
42
46
|
*/
|
|
43
|
-
init() {
|
|
47
|
+
init(options) {
|
|
48
|
+
this.basename = options && options.basename ? options.basename : null;
|
|
44
49
|
// Load routes
|
|
45
50
|
require(process.cwd() + "/app/routes");
|
|
46
51
|
}
|
|
@@ -53,6 +58,9 @@ class RouterFacade {
|
|
|
53
58
|
* @param options
|
|
54
59
|
*/
|
|
55
60
|
register(type, path, component, options) {
|
|
61
|
+
if (this.basename) {
|
|
62
|
+
path = this.basename + path;
|
|
63
|
+
}
|
|
56
64
|
if (type === "GET") {
|
|
57
65
|
this.routesGET[path] = {
|
|
58
66
|
path: path,
|
package/package.json
CHANGED
package/src/Router/Router.ts
CHANGED
|
@@ -12,6 +12,11 @@ type RouteObject = {
|
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
class RouterFacade {
|
|
15
|
+
/**
|
|
16
|
+
* Basename
|
|
17
|
+
*/
|
|
18
|
+
basename: string | null = null;
|
|
19
|
+
|
|
15
20
|
/**
|
|
16
21
|
* GET Route Store
|
|
17
22
|
*/
|
|
@@ -64,7 +69,9 @@ class RouterFacade {
|
|
|
64
69
|
* Load the application-routes
|
|
65
70
|
*
|
|
66
71
|
*/
|
|
67
|
-
init() {
|
|
72
|
+
init(options?: any) {
|
|
73
|
+
this.basename = options && options.basename ? options.basename : null;
|
|
74
|
+
|
|
68
75
|
// Load routes
|
|
69
76
|
require(process.cwd() + "/app/routes");
|
|
70
77
|
}
|
|
@@ -78,6 +85,10 @@ class RouterFacade {
|
|
|
78
85
|
* @param options
|
|
79
86
|
*/
|
|
80
87
|
register(type: string, path: string, component: any, options: object) {
|
|
88
|
+
if (this.basename) {
|
|
89
|
+
path = this.basename + path;
|
|
90
|
+
}
|
|
91
|
+
|
|
81
92
|
if (type === "GET") {
|
|
82
93
|
this.routesGET[path] = {
|
|
83
94
|
path: path,
|