@samveys/grpc
gRPC, gRPC-Web and the Connect protocol from one service definition
This list was read from version 1.0.2; run pnpm sync to refresh it.
import { grpc, GreetRequestSchema, GreetResponseSchema, GreetService } from '@samveys/grpc'
Function (1)
grpc
Function
The `@samveys/grpc` plugin: serves your Connect services over the Connect protocol and gRPC-Web on the app's HTTP port, and over native gRPC on an HTTP/2 port when `http2Port` is set.
function grpc(options: GrpcOptions): import("@samveys/core").Plugin<GrpcOptions>;
Exported from packages/grpc/src/plugin.ts
Value (3)
GreetRequestSchema
Value
No documentation comment.
const GreetRequestSchema: GenMessage<GreetRequest>;
Exported from packages/grpc/src/example.ts
GreetResponseSchema
Value
No documentation comment.
const GreetResponseSchema: GenMessage<GreetResponse>;
Exported from packages/grpc/src/example.ts
GreetService
Value
`samveys.example.v1.GreetService` with one unary method, `Greet`.
const GreetService: GenService<{
greet: {
methodKind: 'unary';
input: typeof GreetRequestSchema;
output: typeof GreetResponseSchema;
};
}>;
Exported from packages/grpc/src/example.ts
Interface (2)
GrpcOptions
Interface
Public contracts of `@samveys/grpc`.
interface GrpcOptions extends Omit<ConnectRouterOptions, 'grpc' | 'grpcWeb' | 'connect'> {
/** Register services: `(router) => router.service(GreetService, impl)`. */
Exported from packages/grpc/src/contracts.ts
GrpcServer
Interface
The `'grpc'` container binding.
interface GrpcServer {
/** Paths served on the app's HTTP port, e.g. `/samveys.example.v1.GreetService/Greet`. */
readonly paths: readonly string[];
/** Address of the HTTP/2 gRPC listener; `undefined` without `http2Port` or before the app has started. */
http2Address(): AddressInfo | undefined;
}
Exported from packages/grpc/src/contracts.ts
Type (2)
GreetRequest
Type
A sample service, written without protoc: the `FileDescriptorProto` of this schema is embedded as base64 and turned into descriptors by the `@bufbuild/protobuf` v2 runtime. ```proto syntax = "proto3"; package samveys.example.v1; message GreetRequest { string name = 1; } message GreetResponse { string greeting = 1; } service GreetService { rpc Greet(GreetRequest) returns (GreetResponse); } ```
type GreetRequest = Message<'samveys.example.v1.GreetRequest'> & {
name: string;
};
Exported from packages/grpc/src/example.ts
GreetResponse
Type
No documentation comment.
type GreetResponse = Message<'samveys.example.v1.GreetResponse'> & {
greeting: string;
};
Exported from packages/grpc/src/example.ts