← back to Dw Internal Gateway
auto-save: 2026-07-23T11:20:37 (1 files) — server.js
b3475eccc391ea6bc7d9837ebb950d84af468fd8 · 2026-07-23 11:20:41 -0700 · Steve Abrams
Files touched
Diff
commit b3475eccc391ea6bc7d9837ebb950d84af468fd8
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Thu Jul 23 11:20:41 2026 -0700
auto-save: 2026-07-23T11:20:37 (1 files) — server.js
---
server.js | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/server.js b/server.js
index 920b470..453f8f6 100644
--- a/server.js
+++ b/server.js
@@ -19,6 +19,38 @@ const ROUTES = JSON.parse(fs.readFileSync(path.join(__dirname, 'routes.json'), '
const pool = new Pool({ host: '/tmp', database: 'dw_unified', max: 5 });
+// ---------- all.dw vendor routing (the canonical schema/UI for vendor products) ----------
+// <vendor>.internal.dw for any vendor in shopify_products = the LOCAL all.dw instance
+// (pm2 all-dw-local :9958) pre-filtered to that vendor — identical rows/cards/facets/sorts
+// to all.designerwallcoverings.com. slugify + BANNED are copied VERBATIM from
+// all-designerwallcoverings/server.js so hostnames match its vendor slugs exactly.
+const ALLDW_PORT = Number(process.env.ALLDW_PORT || 9958);
+const slugify = (v) => String(v || '').toLowerCase().normalize('NFD')
+ .replace(/[̀-ͯ]/g, '').replace(/&/g, ' and ')
+ .replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '');
+// Private-label source names all.dw's public rows exclude — those vendors are served by
+// the generic *_catalog viewer instead (their products surface on all.dw under the label).
+const BANNED = /brewster|york|wallquest|wall\s*quest|newwall|new\s*wall\b|command\s*54|justin\s*david|nicolette\s*mayer|seabrook|chesapeake|nextwall|desima|carlsten/i;
+
+let VENDOR_MAP = new Map(); // slug -> { names: [vendor strings], count }
+let vendorMapAt = 0;
+async function refreshVendorMap() {
+ if (Date.now() - vendorMapAt < 15 * 60 * 1000 && VENDOR_MAP.size) return;
+ const { rows } = await pool.query(
+ `select vendor, count(*)::int as n from shopify_products
+ where vendor is not null and vendor <> '' group by vendor`);
+ const m = new Map();
+ for (const r of rows) {
+ if (BANNED.test(r.vendor)) continue;
+ const slug = slugify(r.vendor);
+ if (!slug) continue;
+ const e = m.get(slug) || { names: [], count: 0 };
+ e.names.push(r.vendor); e.count += r.n;
+ m.set(slug, e);
+ }
+ VENDOR_MAP = m; vendorMapAt = Date.now();
+}
+
// ---------- column auto-detection over heterogeneous *_catalog tables ----------
const CANDIDATES = {
title: ['pattern_name', 'product_name', 'title', 'name', 'pattern', 'design_name', 'style_name'],
← 3f1098b loopback-only bind, port 8090, pm2-managed dnsmasq wildcard
·
back to Dw Internal Gateway
·
every vendor follows all.dw schema: vendor-locked proxy to l e9fe407 →