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

Add support for server side interceptors #982

Merged
merged 3 commits into from
Jan 23, 2024
Merged

Conversation

srikrsna-buf
Copy link
Member

@srikrsna-buf srikrsna-buf commented Jan 19, 2024

Add support for server side interceptors. Reuses the same types of the client side interceptors.

Example:

import { fastify } from "fastify";
import routes from "./connect";
import { fastifyConnectPlugin } from "@connectrpc/connect-fastify";

const server = fastify();

await server.register(fastifyConnectPlugin, {
 routes,
  interceptors: [
    (next) => async (req) => {
      console.log("Request:", req);
      return await next(req);
    },
  ],
});

await server.listen({
  host: "localhost",
  port: 8080,
});

Closes #527

@srikrsna-buf srikrsna-buf merged commit fd34d07 into main Jan 23, 2024
4 checks passed
@srikrsna-buf srikrsna-buf deleted the sk/server-interceptors branch January 23, 2024 10:35
@srikrsna-buf srikrsna-buf mentioned this pull request Feb 28, 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.

Add interceptor capabilities to ConnectRouter
2 participants