alishi973 / grpc-mock-server

no docker needed grpc mock server for mocking simple grpc requests.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Easy-to-Use gRPC Mock Server for use with grpc-web.

How to get start:

  1. Clone this repo:
git clone https://github.com/alishi973/grpc-mock-server
  1. Put your .proto files on /proto folder in the main directory.
  2. Create mock-response.json on the main directory and write your message rpc in JSON format.

Example

{
    "LoginResponse": {
        "token": "abcdefg"
    }
}
  1. Install dependecy yarn install or npm install
  2. Run server with npm start or yarn start

Now gRPC mocked server is ready on port 50051 and proxified server for web application are up on 8080 ports on your machine.

Current proxy is cloned of grpcwebproxy.

You can use bloomRPC for testing mocked server.

Important note for using on web app 🚧

Remember to change proxy:start script on package.json and write your served web application address for allowed_origins parameter (default address is http://localhost:3000)

Last but not least

For using this repo on non Windows OS, you need to replace grpcwebproxy.exe file with your relative reverse proxy and also change name of this file in package.json on proxy:start script (You can find here).

and maybe need some change for unix file addressing.

About

no docker needed grpc mock server for mocking simple grpc requests.


Languages

Language:JavaScript 100.0%