From 84f3977fd4c59cad4d1f9d84edde0302d174aa9b Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Sat, 31 Mar 2018 18:03:05 -0600 Subject: [PATCH] Serve static content correctly --- src/api/Webserver.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/api/Webserver.ts b/src/api/Webserver.ts index 669b12b..74c45bd 100644 --- a/src/api/Webserver.ts +++ b/src/api/Webserver.ts @@ -35,10 +35,13 @@ export default class Webserver { // We register the default route last to make sure we don't override anything by accident. // We'll pass off all other requests to the web app - this.app.get("*", (_req, res) => { + this.app.get(/(widgets\/|riot\/|\/)*/, (_req, res) => { res.sendFile(path.join(__dirname, "..", "..", "web", "index.html")); }); + // Register the static content last + this.app.use(express.static(path.join(__dirname, "..", "..", "web"))); + // Set up the error handler this.app.use((err: any, _req, res, next) => { if (err instanceof ApiError) {