Code Monkey home page Code Monkey logo

gruf-demo's Introduction

README

Running up project

foreman start -f Procfile.dev

How to test out

  • Create product
curl --request POST \
  --url http://localhost:3000/clients \
  --header 'content-type: application/json' \
  --data '{
	"name": "iPhone 11",
	"price": 4444
}'
  • Get products
curl --request GET \
  --url http://localhost:3000/clients
  • Get product
curl --request GET \
  --url http://localhost:3000/clients/1

Build your own one

  • Create a normal rails project by:
rails new <project_name>
  • Add proto file

In my case it is app/proto/Products.proto

  • Generate gRPC services code
./bin/generate_protos.sh
  • Create gRPC Server controller Checkout app/rpc/products_controller.rb

  • How to run up gRPC server?

bundle exec gruf --host=localhost:9003

and your gRPC server will run on port 9003

  • Implement Client controller Checkout app/controllers/clients_controller.rb

  • Run up client as normal rails application

rails s

Your client app will run on port 3000, and we can send a normal HTTP request to this port

gruf-demo's People

Contributors

namtx avatar dependabot[bot] avatar

Stargazers

Roman avatar

Watchers

James Cloos 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.