瀏覽代碼

Server: fix for angular slash-routes

Christian Kahlau 3 年之前
父節點
當前提交
8a0167e8e1
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      server/src/webserver.class.ts

+ 3 - 0
server/src/webserver.class.ts

@@ -1,4 +1,5 @@
 import express, { Express, NextFunction, Request, Response } from 'express';
+import path from 'path';
 
 import { HttpStatusException } from '../../common/lib/http-status.exception';
 import { Logger } from '../../common/util/logger.class';
@@ -17,6 +18,8 @@ export class Webserver {
 
     this.app.use('/', express.static(process.env.STATIC_DIR || 'public'));
 
+    this.app.use('**', express.static(path.join(process.env.STATIC_DIR || 'public', 'index.html')));
+
     this.app.use((err: any, req: Request, res: Response, next: NextFunction) => {
       if (err instanceof HttpStatusException) {
         res.status(err.statusCode).send(err.message);