Class: ProtoCat<Extension>
The main ProtoCat server application class
Type parameters
Name | Type |
---|---|
Extension | unknown |
Constructors
constructor
• new ProtoCat<Extension
>(options?
)
Type parameters
Name | Type |
---|---|
Extension | unknown |
Parameters
Name | Type |
---|---|
options? | ChannelOptions |
Defined in
Properties
methodDefinitions
• Private
methodDefinitions: Record
<string
, MethodDefinition
<any
, any
>>
Map of loaded generated method stubs
Defined in
middleware
• Private
Readonly
middleware: Middleware
<Extension
>[]
Global middleware functions
Defined in
server
• server: Server
Underlying gRPC server
Defined in
serviceHandlers
• Private
serviceHandlers: Record
<string
, Middleware
<unknown
>[]>
Map of loaded method service implementations
Defined in
Methods
addService
▸ addService<T
>(serviceDefinition
, serviceImplementation
): void
Add service stub and its definition
Type parameters
Name | Type |
---|---|
T | extends ServiceDefinition <UntypedServiceImplementation > |
Parameters
Name | Type |
---|---|
serviceDefinition | T |
serviceImplementation | ServiceImplementationExtended <T , Extension > |
Returns
void
Defined in
start
▸ start(address
, creds?
): Promise
<number
>
Internally register handlers, bind port and start server
Parameters
Name | Type | Description |
---|---|---|
address | string | e.g. 0.0.0.0:3000 |
creds | ServerCredentials | - |
Returns
Promise
<number
>
Defined in
stop
▸ stop(): Promise
<void
>
Try to shutdown server gracefully.
Returns
Promise
<void
>
Defined in
use
▸ use(...middleware
): void
Add a global gRPC middleware for the application
Parameters
Name | Type |
---|---|
...middleware | Middleware <Extension >[] |
Returns
void