🌀 SubdomainRouting Support
Use SubdomainRouting to manage subdomains: And ensure the middleware is applied:
1import { Routes, Middlewares } from "hbh-der";2app.use(3 Middlewares.subdomainParser({4 baseDomainLevels: 1 /* based on '.' */,5 reverse: false,6 })7);8app.get(9 "/",10 Routes.SubdomainRouting({11 api: (req, res) => res.send("API subdomain"),12 admin: (req, res) => res.send("Admin subdomain"),13 "blog.api": (req, res) => res.send("Blog under API subdomain"),14 "*": (req, res) =>15 res.send(`Wildcard handler: ${req._subdomains.join(".")}`),16 "/": (req, res) => res.send("Main domain (no subdomain)"),17 })18);