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
/proto
folder in the main directory. - Create
mock-response.json
on the main directory and write yourmessage rpc
in JSON format.
{
"LoginResponse": {
"token": "abcdefg"
}
}
- Install dependecy
yarn install
ornpm install
- Run server with
npm start
oryarn 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.