Giter Site home page Giter Site logo

grpc-healthcare-app's Introduction

How to Run this App

First of all, you need to install Ballerina language 1.2.0+. Please refer to the official Ballerina website to follow the step by step guidelines to install Ballerina language in your preferred platform (macOS, Linux, or Windows). There are installers released for each platform. However, I normally preferred to use binaries to install Ballerina even though it is not the easiest way to do it.

Install Ballerina using Binaries

  1. Download Ballerina 1.2.0+ binaries from here.
  2. Extract the zip file. Let assume you have extracted into your /home directory. Now you have Ballerina binaries in a directory called /home/ballerina-1.2.0/.
  3. Setup your PATH environment variables like below (Normally, in Linux and macOS environments you can set the PATH variable by changing one of ~/.bash_profile, ~/.bashrc, ~/.zshrc, or ~/.profile files).
    export BALLERINA_HOME="/home/ballerina-1.2.0/bin"
    export PATH=$PATH:$BALLERINA_HOME
  4. That's it, now you can simply reload the terminal and verify ballerina installation.
    $ ballerina version

Run this gRPC Healthcare App

  1. Clone this repository.
    $ git clone https://github.com/BuddhiWathsala/grpc-healthcare-app.git
  2. Navigate to the app.
    $ cd grpc-healthcare-app
  3. Build the app.
    $ ballerina build -a
  4. Run the gRPC server.
    $ ballerina run target/bin/server.jar
  5. In another terminal, run the gRPC client.
    $ ballerina run target/bin/client.jar

How to Develop a gRPC Ballerina App

Before implementing a gRPC Ballerina app, you need to install Ballerina as I discussed in the previous section.

After that, you can create a new Ballerina project using the following command.

$ ballerina new grpc-healthcare-app

In this implementation, I have created two separate modules for the client and the server implementation. Create client and server Ballerina modules as follows.

$ cd grpc-healthcare-app
$ ballerina add client
$ ballerina add server

The Ballerina CLI tool has enriched with the support of generating boilerplate codes of the gRPC server and client. Hence, you can generate boilerplate codes of the server and the client using the following commands.

Server Code Generation:

$ cd src/server
$ ballerina grpc --input health-stub.proto --mode service --output .

Client Code Generation:

$ cd src/client
$ ballerina grpc --input health-stub.proto --mode client --output .

References

  1. https://ballerina.io/v1-1/learn/by-example/
  2. https://grpc.io/docs/
  3. https://developers.google.com/protocol-buffers/docs/overview

grpc-healthcare-app's People

Contributors

buddhiwathsala avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.