Easy-to-Use gRPC Mock Server for use with grpc-web.
- Clone this repo:
git clone https://github.com/alishi973/grpc-mock-server- Put your .proto files on
/protofolder in the main directory. - Create
mock-response.jsonon the main directory and write yourmessage rpcin JSON format.
{
"LoginResponse": {
"token": "abcdefg"
}
}- Install dependecy
yarn installornpm install - Run server with
npm startoryarn 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.
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)
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.