Skip to content

Latest commit

 

History

History
36 lines (26 loc) · 1.42 KB

README.md

File metadata and controls

36 lines (26 loc) · 1.42 KB

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.