boxlang-express 0.1.14

Released .

  • Fix + feature: app.get(path, ...) routes now automatically answer HEAD too — same handler and headers (including Content-Length), body discarded, same as Express — instead of 404ing. This also fixes a real bug in static file serving: it already accepted HEAD requests, but sent the full file body anyway, a spec violation for a HEAD response. Register app.head(path, ...) explicitly (before the matching app.get()) only when HEAD should behave differently than discarding the GET body.
  • Fix: app.use()/router.use() only ever accepted a single handler (or a single path + single handler), unlike route registration (app.get(path, mw1, mw2, handler)), which already took a variadic chain. Calling app.use(mw1, mw2, mw3) — a common Express pattern — didn't just silently drop the extra arguments, it threw a confusing low-level error (the second handler got mistaken for a mount path). use() now accepts any number of handlers (and/or a Router) in one call, at the same mount point, registered in order. See Router.bx.
  • Added boxExpressHelmet() — security-headers middleware mirroring the npm helmet package's most commonly used defaults (X-Frame-Options, X-Content-Type-Options, Referrer-Policy, etc.), each individually overridable or disable-able. Strict-Transport-Security and Content-Security-Policy are opt-in rather than on by default. See Helmet.bx.
  • Added boxExpressCors() — Cross-Origin Resource Sharing middleware mirroring the npm cors package's common options (origin, methods, allowedHeaders, credentials, maxAge). Answers a CORS preflight OPTIONS request directly, since nothing would otherwise be registered to handle it. See Cors.bx.
  • Added boxExpressRateLimit() — fixed-window rate limiting mirroring the npm express-rate-limit package's common options (windowMs, max, keyGenerator), keyed by req.ip by default. Sets the draft-standard RateLimit-* headers and responds 429 with Retry-After once a key's count exceeds max. See RateLimit.bx.
  • Added boxExpressCsrf() — CSRF protection mirroring the classic csurf package's session-based token strategy. Requires req.session (register after boxExpressSession(), which it throws immediately about if missing); exposes req.csrfToken(), validates req.body._csrf (or a request header) on every method other than GET/HEAD/OPTIONS. See Csrf.bx.
  • boxExpressStatic()/res.sendFile() now accept options.maxAge (seconds) to set Cache-Control: public, max-age=<n> alongside the ETag/Last-Modified they already set — off by default, no header at all unless asked for.
  • Added boxExpressCacheStore() — a Session store backed by BoxLang's own cache() service, so { store: boxExpressCacheStore( "sessions" ) } makes sessions durable across restarts and shared across a cluster when the named cache is configured with objectStore: "JDBCStore" (a real SQL table) instead of the in-memory default. See CacheStore.bx.