Browse Source

v1.0.2a: views

CrazyDoctor 8 months ago
parent
commit
56eed251af

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

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

+ 3 - 0
dist/server/Server.js

@@ -61,6 +61,7 @@ class Server {
         this.middlewaresPath = properties.middlewaresPath;
         this.routesPath = properties.routesPath;
         this.viewEngine = properties.viewEngine;
+        this.viewsPath = properties.viewsPath;
         this.initialized = false;
     }
     init() {
@@ -83,6 +84,8 @@ class Server {
                 yield this.registerRoutes(this.routesPath);
             if (this.viewEngine)
                 this.instance.set('view engine', this.viewEngine);
+            if (this.viewsPath)
+                this.instance.set('views', this.viewsPath);
         });
     }
     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;
     routesPath?: string;
     viewEngine?: string;
+    viewsPath?: string;
 };
 export { ServerProperties };

+ 4 - 0
lib/server/Server.ts

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

+ 2 - 1
lib/server/ServerProperties.ts

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

+ 1 - 1
package.json

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