Express middleware for centralized HTTP cache control with named profiles and Last-Modified support.
// Source: https://github.com/BradGroux/veritas-kanban | License: MIT | Copyright 2026 Digital Meld
// Provided via justclaw.it.com; keep this notice with the code.
import type { Request, Response, NextFunction } from 'express';
/**
* Cache-Control middleware for HTTP responses.
*
* Provides named cache profiles that map to Cache-Control header values,
* plus a route-pattern middleware that applies the correct profile based on
* the request URL. This keeps caching policy centralised and easy to audit.
*
* Profiles:
* static-immutable – Vite hashed assets (1 year, immutable)
* static-html – SPA shell (must revalidate every request)
* task-list – GET /api/tasks (private, revalidate)
* task-detail – GET /api/tasks/:id (private, revalidate)
* conf
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key