Skip to content

Latest commit

 

History

History
30 lines (22 loc) · 847 Bytes

README.md

File metadata and controls

30 lines (22 loc) · 847 Bytes

grpc-mock-server

gRPC mock server for tests with typescript definitions.

NPM CI

Installation:

NPM link

npm i @alenon/grpc-mock-server

Usage example:

private static readonly PROTO_PATH: string = __dirname + "example.proto";
private static readonly PKG_NAME: string = "com.alenon.example";
private static readonly SERVICE_NAME: string = "ExampleService";

...

const implementations = {
    ex1: (call: any, callback: any) => {
        const response: any =
            new this.proto.ExampleResponse.constructor({msg: "the response message"});
        callback(null, response);
    },
};

this.server.addService(PROTO_PATH, PKG_NAME, SERVICE_NAME, implementations);
this.server.start();