[object Object]

← back to Mylarwallpaper

fix: /api/facets total uses niche-filtered count; add clean-URL routes for about/history/care/sourcing/trade

225f081b58427ea225e8d3d0fefe1acadb714bf8 · 2026-05-18 20:48:49 -0700 · Steve Abrams

Files touched

Diff

commit 225f081b58427ea225e8d3d0fefe1acadb714bf8
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Mon May 18 20:48:49 2026 -0700

    fix: /api/facets total uses niche-filtered count; add clean-URL routes for about/history/care/sourcing/trade
---
 server.js | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/server.js b/server.js
index 818e2c4..b813506 100644
--- a/server.js
+++ b/server.js
@@ -170,7 +170,7 @@ app.get('/api/facets', (req, res) => {
     aesthetics[p.aesthetic] = (aesthetics[p.aesthetic] || 0) + 1;
     vendors[p.vendor] = (vendors[p.vendor] || 0) + 1;
   }
-  res.json({ aesthetics, vendors, total: PRODUCTS.length });
+  res.json({ aesthetics, vendors, total: PRODUCTS_NICHE.length });
 });
 
 app.get('/api/health', (req, res) => res.json({ status: 'ok', count: PRODUCTS_NICHE.length, dropped: DROPPED }));
@@ -197,6 +197,21 @@ ${urls.map(u => `  <url><loc>https://mylarwallpaper.com${u}</loc><changefreq>wee
   res.type('application/xml').send(xml);
 });
 
+// Clean-URL routes for static info pages.
+const PAGE_ROUTES = {
+  '/about': 'history.html',
+  '/history': 'history.html',
+  '/care': 'care.html',
+  '/sourcing': 'sourcing.html',
+  '/trade': 'trade.html',
+};
+for (const [route, file] of Object.entries(PAGE_ROUTES)) {
+  const abs = path.join(__dirname, 'public', file);
+  if (fs.existsSync(abs)) {
+    app.get(route, (req, res) => res.sendFile(abs));
+  }
+}
+
 app.listen(PORT, '127.0.0.1', () => {
   console.log(`mylarwallpaper listening on http://127.0.0.1:${PORT}`);
 });

← dcd1cc1 fix: pass sort param to /api/products query and hydrate sort  ·  back to Mylarwallpaper  ·  chore: untrack 21 stale .bak/.pre-* snapshot files and gitig cf0c79f →