Selaa lähdekoodia

Server: fix for angular slash-routes

Christian Kahlau 3 vuotta sitten
vanhempi
commit
8a0167e8e1
1 muutettua tiedostoa jossa 3 lisäystä ja 0 poistoa
  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);