Skip to content
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

Create and use middlewares #699

Open
wants to merge 3 commits into
base: release/4.0.0
Choose a base branch
from

Conversation

Assem-Hafez
Copy link
Contributor

@Assem-Hafez Assem-Hafez commented Oct 21, 2024

Summary

Create middleware utility to encapsulate reusable logic before rest apis.

Middlewares design

  • Each middleware can return either a NextResponse, null, undefined or a tuple representing [key,value] to add to the context.
  • If a middleware returned a NextResponse remaining middlewares wont execute and the value is returned.
  • If a context tuple is returned it will be added to the current context object and passed to the next middleware.
  • After all middlewares are executed an non of them return NextResponse the handler would be invoked with the computed context.

Changes

  • Create middlewares util
  • Create grpc methods middleware
  • grpc methods middleware can accept grpcMetadata from the context
  • refactor grpc-client

@Assem-Hafez Assem-Hafez marked this pull request as ready for review October 21, 2024 13:47
@Assem-Uber Assem-Uber changed the title create and use middlewares Create and use middlewares Oct 21, 2024
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