Skip to content

refactor(middleware)!: standardize middleware naming#38

Merged
halvaradop merged 1 commit intomasterfrom
refactor/update-middleware-naming
Feb 24, 2026
Merged

refactor(middleware)!: standardize middleware naming#38
halvaradop merged 1 commit intomasterfrom
refactor/update-middleware-naming

Conversation

@halvaradop
Copy link
Copy Markdown
Member

@halvaradop halvaradop commented Feb 24, 2026

Description

This pull request standardizes middleware naming by replacing the middlewares property with use. The change aligns the API with common conventions in backend frameworks such as Express, Hono, and Fastify, where use is the standard keyword for registering middleware. The underlying middleware behavior and execution model remain unchanged.

Note

BREAKING CHANGE: Middleware configuration has been renamed. Update all imports and usage from middlewares to use.

Summary by CodeRabbit

Release Notes

  • Breaking Changes

    • Renamed the middlewares configuration option to use across all routing configuration paths (router configuration, endpoint configuration, and endpoint configs)
  • Documentation

    • Updated all examples and documentation to reflect the new use property name throughout the API

BREAKING CHANGE: middleware names have changed.
Update imports and usage to the new names.
@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
router Ready Ready Preview, Comment Feb 24, 2026 3:16pm

@halvaradop halvaradop merged commit a775866 into master Feb 24, 2026
5 checks passed
@halvaradop halvaradop deleted the refactor/update-middleware-naming branch February 24, 2026 15:20
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 24, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8889864 and 9e0d251.

📒 Files selected for processing (14)
  • CHANGELOG.md
  • docs/src/content/docs/create-endpoint-config.mdx
  • docs/src/content/docs/create-endpoint.mdx
  • docs/src/content/docs/create-router.mdx
  • docs/src/content/docs/index.mdx
  • docs/src/content/docs/middlewares.mdx
  • src/endpoint.ts
  • src/middlewares.ts
  • src/router.ts
  • src/types.ts
  • test/client.test.ts
  • test/endpoint.test.ts
  • test/router.test.ts
  • test/type.test-d.ts

📝 Walkthrough

Walkthrough

This PR renames the public configuration option middlewares to use across router, endpoint, and endpoint configuration APIs. The behavior and functionality remain unchanged; only the property name is updated throughout type definitions, implementation, documentation, and tests.

Changes

Cohort / File(s) Summary
Type Definitions
src/types.ts
Renamed middlewares to use in both EndpointConfig and RouterConfig public interfaces.
Implementation
src/middlewares.ts, src/router.ts, src/endpoint.ts
Updated middleware execution functions and router configuration access to reference the renamed use property instead of middlewares. Added null/undefined guards for the new property name.
Documentation
docs/src/content/docs/create-router.mdx, docs/src/content/docs/create-endpoint.mdx, docs/src/content/docs/create-endpoint-config.mdx, docs/src/content/docs/index.mdx, docs/src/content/docs/middlewares.mdx
Updated all code examples and configuration references to use use instead of middlewares. Also updated RouteEndpoint generic to accept `HTTPMethod
Tests
test/endpoint.test.ts, test/router.test.ts, test/type.test-d.ts, test/client.test.ts
Updated test configurations and type expectations to use use instead of middlewares. Converted async fetch mock to synchronous function in client tests.
CHANGELOG
CHANGELOG.md
Added BREAKING CHANGES entry documenting the rename from middlewares to use.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

enhancement

Poem

🐰 Middleware hops with a newer name,
From middlewares to use—still the same game,
Configuration refined with a sleeker call,
Hopping through endpoints, routers, and all! ✨

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/update-middleware-naming

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

1 participant