Skip to content

examples: add Express microservice demo with ETag & 304 validation - #1

Merged
cursor[bot] merged 2 commits into
mainfrom
cursor/express-api-etag-demo-33b2
Sep 19, 2026
Merged

cursor[bot] merged 2 commits into
mainfrom
cursor/express-api-etag-demo-33b2

Conversation

@dyk1454683243-sudo

@dyk1454683243-sudo dyk1454683243-sudo commented Sep 17, 2026

Copy link
Copy Markdown
Owner

Description

Adds a runnable Express reference microservice at examples/express-api/ that uses the official tricache/http middleware (createExpressMiddleware).

This demonstrates the HTTP route-cache contract from Kareem411/TriCache#25:

  • Weak ETag calculation (ETag: W/"…")
  • RFC 7232 conditional requests (If-None-Match304 Not Modified, empty body)
  • Deterministic query-parameter sorting (?limit=5&page=2?page=2&limit=5)
  • headerWhitelist: ['accept-language'] (locale-specific cache entries)
  • Custom skipCache for Authorization (authenticated traffic always hits origin)

The example README includes pnpm dev / pnpm start and a curl -i walkthrough. pnpm verify starts the server and asserts the five behaviors.

HTTP integration docs now point at the demo and use the real middleware options object ({ cache, ttl, swr, … }) instead of the outdated (cache, { ttlSeconds }) signature.

Preferred review target: Kareem411/TriCache#35 (same branch, opened against upstream main). This fork PR is a fallback.

Fixes Kareem411#25
Fixes Kareem411#25

Type of Change

  • 📝 Documentation update

How to verify

# from repository root
pnpm install
pnpm build
cd examples/express-api
pnpm install
pnpm dev

Then run the curl -i commands in examples/express-api/README.md, or:

pnpm verify

Verified locally: pnpm typecheck and pnpm verify both pass (weak ETag, query-order hit, 304, Accept-Language: fr, Authorization bypass).

Open in Web Open in Cursor 

cursoragent and others added 2 commits September 17, 2026 06:22
Add a runnable examples/express-api microservice using createExpressMiddleware
from tricache/http (weak ETag, If-None-Match 304, sorted query keys,
accept-language whitelist, skipCache for Authorization) and link it from the
HTTP integration docs.

Co-authored-by: David <dyk1454683243-sudo@users.noreply.github.com>
Use node:http in pnpm verify so Cache-Control from fetch cannot
bypass the middleware, and document capturing ETag from GET instead
of curl -sI (HEAD is a different cache key).

Co-authored-by: David <dyk1454683243-sudo@users.noreply.github.com>
@cursor
cursor Bot merged commit 13260a8 into main Sep 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

examples: add Express microservice demo with ETag & 304 validation

2 participants