Skip to content

armgit / dashy

Public Imported from GitHub
0

πŸš€ A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!

πŸ‘” Use a 404 status code if page not found (fixes #1136)

Alicia Sykes27995f850018
diff --git a/server.js b/server.js
index 3920f748..1a7b2c9e 100644
--- a/server.js
+++ b/server.js
@@ -122,8 +122,10 @@ const app = express()
res.end(JSON.stringify({ success: false, message: e }));
}
})
- // GET fallback endpoint
- .get('*', (req, res) => res.sendFile(path.join(__dirname, 'dist', 'index.html')));
+ // If no other route is matched, serve up the index.html with a 404 status
+ .use((req, res) => {
+ res.status(404).sendFile(path.join(__dirname, 'dist', 'index.html'));
+ });
/* Create HTTP server from app on port, and print welcome message */
http.createServer(app)