Browse Source

v1.1.5: Server:getHost() method

CrazyDoctor 3 days ago
parent
commit
aff2bf43ca
5 changed files with 11 additions and 3 deletions
  1. 1 0
      dist/server/Server.d.ts
  2. 4 1
      dist/server/Server.js
  3. 0 0
      dist/server/Server.js.map
  4. 5 1
      lib/server/Server.ts
  5. 1 1
      package.json

+ 1 - 0
dist/server/Server.d.ts

@@ -49,6 +49,7 @@ declare class Server {
     registerMiddlewares(dir: string): Promise<Server>;
     getLogger(): Logger;
     i18nLoad(path: string): Server;
+    getHost(): string;
     getOption(key: string): any;
     start(callback?: () => any): void;
 }

+ 4 - 1
dist/server/Server.js

@@ -59,7 +59,7 @@ class Server {
         this.instance = (0, express_1.default)();
         this.httpServer = http_2.default.createServer(this.instance);
         this.port = properties.port;
-        this.host = properties.host || 'http://localhost:3000';
+        this.host = properties.host || `http://localhost:${this.port}`;
         this.i18n = i18n_1.i18nLoader.getInstance();
         if (properties.locale)
             this.i18n.setLocale(properties.locale);
@@ -280,6 +280,9 @@ class Server {
         this.i18n.load(path);
         return this;
     }
+    getHost() {
+        return this.host;
+    }
     getOption(key) {
         return this.options ? this.options[key] || null : null;
     }

File diff suppressed because it is too large
+ 0 - 0
dist/server/Server.js.map


+ 5 - 1
lib/server/Server.ts

@@ -49,7 +49,7 @@ class Server {
 		this.instance = express();
 		this.httpServer = http.createServer(this.instance);
 		this.port = properties.port;
-		this.host = properties.host || 'http://localhost:3000';
+		this.host = properties.host || `http://localhost:${this.port}`;
 		this.i18n = i18nLoader.getInstance();
 		if(properties.locale)
 			this.i18n.setLocale(properties.locale);
@@ -287,6 +287,10 @@ class Server {
 		return this;
 	}
 
+	public getHost(): string {
+		return this.host;
+	}
+
 	public getOption(key: string): any {
 		return this.options ? this.options[key] || null : null;
 	}

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "org.crazydoctor.expressts",
-  "version": "1.1.4",
+  "version": "1.1.5",
   "devDependencies": {
     "@types/express-session": "^1.17.7",
     "@types/node": "^20.4.9",

Some files were not shown because too many files changed in this diff