Skip to content

examples: add Fastify REST API demo with plugin and route preHandler #26

Description

@Kareem411

Goal

Add a runnable Fastify REST API demo in examples/fastify-api/ demonstrating TriCache's official Fastify caching plugin (tricache/http).

Scope

  1. Create a minimal Fastify application in examples/fastify-api/.
  2. 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 }))
  3. Showcase early short-circuiting in onRequest, response payload capture in onSend, weak ETag calculation, and 304 Not Modified conditional responses.
  4. Include a clean README.md with instructions to run locally and test via curl -i.

References

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationgood first issueGood for newcomershelp wantedExtra attention is needed

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions