Browse Source

1.0.4: server options

CrazyDoctor 8 months ago
parent
commit
88ac316ea9

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

@@ -17,6 +17,7 @@ declare class Server {
     private readonly routesPath?;
     private readonly viewEngine?;
     private readonly viewsPath?;
+    private readonly options?;
     constructor(properties: ServerProperties);
     init(): Promise<Server>;
     private postInit;
@@ -33,6 +34,7 @@ declare class Server {
     registerMiddlewares(dir: string): Promise<Server>;
     getLogger(): Logger;
     i18nLoad(path: string): Server;
+    getOption(key: string): any;
     start(callback?: () => any): void;
 }
 export { Server };

+ 4 - 0
dist/server/Server.js

@@ -62,6 +62,7 @@ class Server {
         this.routesPath = properties.routesPath;
         this.viewEngine = properties.viewEngine;
         this.viewsPath = properties.viewsPath;
+        this.options = properties.options;
         this.initialized = false;
     }
     init() {
@@ -185,6 +186,9 @@ class Server {
         this.i18n.load(path);
         return this;
     }
+    getOption(key) {
+        return this.options ? this.options[key] || null : null;
+    }
     start(callback) {
         if (!this.initialized)
             throw new exceptions_5.ServerNotInitializedException();

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


+ 3 - 0
dist/server/ServerProperties.d.ts

@@ -6,5 +6,8 @@ type ServerProperties = {
     routesPath?: string;
     viewEngine?: string;
     viewsPath?: string;
+    options?: {
+        [key: string]: any;
+    };
 };
 export { ServerProperties };

+ 6 - 0
lib/server/Server.ts

@@ -28,6 +28,7 @@ class Server {
 	private readonly routesPath?: string;
 	private readonly viewEngine?: string;
 	private readonly viewsPath?: string;
+	private readonly options?: {[key: string]: any};
 
 	public constructor(properties: ServerProperties) {
 		this.instance = express();
@@ -42,6 +43,7 @@ class Server {
 		this.routesPath = properties.routesPath;
 		this.viewEngine = properties.viewEngine;
 		this.viewsPath = properties.viewsPath;
+		this.options = properties.options;
 		this.initialized = false;
 	}
 
@@ -172,6 +174,10 @@ class Server {
 		return this;
 	}
 
+	public getOption(key: string): any {
+		return this.options ? this.options[key] || null : null;
+	}
+
 	public start(callback?: () => any): void {
 		if(!this.initialized)
 			throw new ServerNotInitializedException();

+ 2 - 1
lib/server/ServerProperties.ts

@@ -5,7 +5,8 @@ type ServerProperties = {
 	middlewaresPath?: string,
 	routesPath?: string,
   viewEngine?: string,
-  viewsPath?: string
+  viewsPath?: string,
+  options?: {[key: string] : any}
 };
 
 export { ServerProperties };

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "org.crazydoctor.expressts",
-  "version": "1.0.3",
+  "version": "1.0.4",
   "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