Browse Source

v1.0.2a: views

CrazyDoctor 7 months ago
parent
commit
56eed251af

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

@@ -16,6 +16,7 @@ declare class Server {
     private readonly middlewaresPath?;
     private readonly middlewaresPath?;
     private readonly routesPath?;
     private readonly routesPath?;
     private readonly viewEngine?;
     private readonly viewEngine?;
+    private readonly viewsPath?;
     constructor(properties: ServerProperties);
     constructor(properties: ServerProperties);
     init(): Promise<Server>;
     init(): Promise<Server>;
     private postInit;
     private postInit;

+ 3 - 0
dist/server/Server.js

@@ -61,6 +61,7 @@ class Server {
         this.middlewaresPath = properties.middlewaresPath;
         this.middlewaresPath = properties.middlewaresPath;
         this.routesPath = properties.routesPath;
         this.routesPath = properties.routesPath;
         this.viewEngine = properties.viewEngine;
         this.viewEngine = properties.viewEngine;
+        this.viewsPath = properties.viewsPath;
         this.initialized = false;
         this.initialized = false;
     }
     }
     init() {
     init() {
@@ -83,6 +84,8 @@ class Server {
                 yield this.registerRoutes(this.routesPath);
                 yield this.registerRoutes(this.routesPath);
             if (this.viewEngine)
             if (this.viewEngine)
                 this.instance.set('view engine', this.viewEngine);
                 this.instance.set('view engine', this.viewEngine);
+            if (this.viewsPath)
+                this.instance.set('views', this.viewsPath);
         });
         });
     }
     }
     processHttpHandlers() {
     processHttpHandlers() {

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


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

@@ -5,5 +5,6 @@ type ServerProperties = {
     middlewaresPath?: string;
     middlewaresPath?: string;
     routesPath?: string;
     routesPath?: string;
     viewEngine?: string;
     viewEngine?: string;
+    viewsPath?: string;
 };
 };
 export { ServerProperties };
 export { ServerProperties };

+ 4 - 0
lib/server/Server.ts

@@ -27,6 +27,7 @@ class Server {
 	private readonly middlewaresPath?: string;
 	private readonly middlewaresPath?: string;
 	private readonly routesPath?: string;
 	private readonly routesPath?: string;
 	private readonly viewEngine?: string;
 	private readonly viewEngine?: string;
+	private readonly viewsPath?: string;
 
 
 	public constructor(properties: ServerProperties) {
 	public constructor(properties: ServerProperties) {
 		this.instance = express();
 		this.instance = express();
@@ -40,6 +41,7 @@ class Server {
 		this.middlewaresPath = properties.middlewaresPath;
 		this.middlewaresPath = properties.middlewaresPath;
 		this.routesPath = properties.routesPath;
 		this.routesPath = properties.routesPath;
 		this.viewEngine = properties.viewEngine;
 		this.viewEngine = properties.viewEngine;
+		this.viewsPath = properties.viewsPath;
 		this.initialized = false;
 		this.initialized = false;
 	}
 	}
 
 
@@ -61,6 +63,8 @@ class Server {
 			await this.registerRoutes(this.routesPath);
 			await this.registerRoutes(this.routesPath);
 		if(this.viewEngine)
 		if(this.viewEngine)
 			this.instance.set('view engine', this.viewEngine);
 			this.instance.set('view engine', this.viewEngine);
+		if(this.viewsPath)
+			this.instance.set('views', this.viewsPath);
 	}
 	}
 
 
 	private processHttpHandlers(): void {
 	private processHttpHandlers(): void {

+ 2 - 1
lib/server/ServerProperties.ts

@@ -4,7 +4,8 @@ type ServerProperties = {
 	i18nPath?: string,
 	i18nPath?: string,
 	middlewaresPath?: string,
 	middlewaresPath?: string,
 	routesPath?: string,
 	routesPath?: string,
-  viewEngine?: string
+  viewEngine?: string,
+  viewsPath?: string
 };
 };
 
 
 export { ServerProperties };
 export { ServerProperties };

+ 1 - 1
package.json

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