@webtypen/webframez-core 0.0.12 → 0.0.14

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.
@@ -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
  *
@@ -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,
@@ -11,7 +11,9 @@ class WebApplication {
11
11
  * Init the routes and start the http-server
12
12
  */
13
13
  boot(options) {
14
- Router_1.Router.init();
14
+ Router_1.Router.init({
15
+ basename: options && options.basename ? options.basename : null,
16
+ });
15
17
  const port = options && options.port ? options.port : 3000;
16
18
  this.server = http_1.default
17
19
  .createServer((req, res) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webtypen/webframez-core",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
4
4
  "description": "The core package of the typescript based webframez (web-framework) by webtypen.de",
5
5
  "homepage": "https://webtypen.de/",
6
6
  "license": "MIT",
@@ -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,
@@ -8,7 +8,9 @@ export class WebApplication {
8
8
  * Init the routes and start the http-server
9
9
  */
10
10
  boot(options?: any) {
11
- Router.init();
11
+ Router.init({
12
+ basename: options && options.basename ? options.basename : null,
13
+ });
12
14
 
13
15
  const port = options && options.port ? options.port : 3000;
14
16
  this.server = http