Skip to content

docs: improve README with updated usage examples #360

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

williamfds
Copy link

@williamfds williamfds commented May 29, 2025

Summary

This PR improves the README.md by adding a clear and minimal TypeScript usage example, aligning with the plugin's existing TypeScript support.

What's Changed

  • Added a dedicated section for TypeScript usage
  • Included a type-safe compression example with reply.compress
  • Ensured consistency with the rest of the documentation

Motivation

Many developers using Fastify rely on TypeScript. While the plugin is compatible, the README lacked a direct TypeScript example. This addition makes it easier for TypeScript users to understand how to integrate @fastify/compress effectively.


Checklist

  • Documentation was updated (README.md)
  • Commit message follows the Developer's Certification of Origin
  • Run npm run test and npm run benchmark (not applicable to docs-only change)
  • Tests and/or benchmarks are included (not applicable)

Copy link
Member

@jsumners jsumners left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's Changed

  • Added complete usage examples for both compression and decompression
  • Clarified per-route and global configuration
  • Improved formatting and consistency
  • Fixed minor typos and outdated content
  • Ensured compatibility with TypeScript examples

Motivation

This update provides clearer guidance for new users and better illustrates advanced use cases like inflateIfDeflated, removeContentLengthHeader, and customTypes.

I don't see any of that in this change set. All I see is the addition of a TypeScript example.

@williamfds
Copy link
Author

Hi @jsumners

Thanks for the initial review!

I've now updated the PR with:

  • A new Usage Highlights section covering advanced features like:
    • inflateIfDeflated
    • removeContentLengthHeader
    • customTypes using both regex and function

Let me know if you think it’s ready or if you'd like any further adjustments.

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

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.

3 participants