Browse Source

1.0.2: view engine setting

CrazyDoctor 8 months ago
parent
commit
fdc981eade

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

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

+ 3 - 0
dist/server/Server.js

@@ -60,6 +60,7 @@ class Server {
         this.i18nPath = properties.i18nPath;
         this.middlewaresPath = properties.middlewaresPath;
         this.routesPath = properties.routesPath;
+        this.viewEngine = properties.viewEngine;
         this.initialized = false;
     }
     init() {
@@ -80,6 +81,8 @@ class Server {
                 yield this.registerMiddlewares(this.middlewaresPath);
             if (this.routesPath)
                 yield this.registerRoutes(this.routesPath);
+            if (this.viewEngine)
+                this.instance.set('view engine', this.viewEngine);
         });
     }
     processHttpHandlers() {

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


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

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

+ 4 - 0
lib/server/Server.ts

@@ -26,6 +26,7 @@ class Server {
 	private readonly i18nPath?: string;
 	private readonly middlewaresPath?: string;
 	private readonly routesPath?: string;
+	private readonly viewEngine?: string;
 
 	public constructor(properties: ServerProperties) {
 		this.instance = express();
@@ -38,6 +39,7 @@ class Server {
 		this.i18nPath = properties.i18nPath;
 		this.middlewaresPath = properties.middlewaresPath;
 		this.routesPath = properties.routesPath;
+		this.viewEngine = properties.viewEngine;
 		this.initialized = false;
 	}
 
@@ -57,6 +59,8 @@ class Server {
 			await this.registerMiddlewares(this.middlewaresPath);
 		if(this.routesPath)
 			await this.registerRoutes(this.routesPath);
+		if(this.viewEngine)
+			this.instance.set('view engine', this.viewEngine);
 	}
 
 	private processHttpHandlers(): void {

+ 2 - 1
lib/server/ServerProperties.ts

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

+ 1 - 1
package.json

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