Browse Source

1.0.4: server options

CrazyDoctor 7 months ago
parent
commit
88ac316ea9

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

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

+ 4 - 0
dist/server/Server.js

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

+ 6 - 0
lib/server/Server.ts

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

+ 2 - 1
lib/server/ServerProperties.ts

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

+ 1 - 1
package.json

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

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