Goal
Add a runnable Fastify REST API demo in examples/fastify-api/ demonstrating TriCache's official Fastify caching plugin (tricache/http).
Scope
- Create a minimal Fastify application in
examples/fastify-api/.
- Demonstrate both usage styles supported by
createFastifyPlugin:
- Global plugin registration (
fastify.register(createFastifyPlugin(cache, options)))
- Route-level
preHandler hook (fastify.get('/route', { preHandler: plugin.preHandler }))
- Showcase early short-circuiting in
onRequest, response payload capture in onSend, weak ETag calculation, and 304 Not Modified conditional responses.
- Include a clean
README.md with instructions to run locally and test via curl -i.
References
Goal
Add a runnable Fastify REST API demo in
examples/fastify-api/demonstrating TriCache's official Fastify caching plugin (tricache/http).Scope
examples/fastify-api/.createFastifyPlugin:fastify.register(createFastifyPlugin(cache, options)))preHandlerhook (fastify.get('/route', { preHandler: plugin.preHandler }))onRequest, response payload capture inonSend, weak ETag calculation, and304 Not Modifiedconditional responses.README.mdwith instructions to run locally and test viacurl -i.References
src/http/fastify.ts