Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/cassioroos/grpc_currency

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/cassioroos/grpc_currency

  • v0.0.0-20200816014156-115e60de24fd
  • Source
  • Go
  • Socket score

Version published
Created
Source

Currency Service

This is a simple test of GRPC, the idea is to enrich this server later.

Installing dependencies

You will have to install protoc to generate the code and grpcurl to test the code.

Linux

sudo apt install protobuf-compiler

Mac

brew install protoc

Then run the build command:

protoc -I protos/ protos/currency.proto --go_out=plugins=grpc:protos/currency

or

make protos

Running the application

As this is a POC, all ports and configurations are hardcoded the app will run on port :9098

go run main.go

With grpcurl installed we can test our server

List Services

grpcurl --plaintext localhost:9092 list
Currency
grpc.reflection.v1alpha.ServerReflection

List Methods

grpcurl --plaintext localhost:9098 list Currency        
Currency.GetRate

Method detail for GetRate

grpcurl --plaintext localhost:9098 describe Currency.GetRate
Currency.GetRate is a method:
rpc GetRate ( .RateRequest ) returns ( .RateResponse );

RateRequest detail

grpcurl --plaintext localhost:9098 describe .RateRequest    
RateRequest is a message:
message RateRequest {
  string Base = 1;
  string Destination = 2;
}

Execute a request

grpcurl --plaintext -d '{"Base": "BR", "Destination": "USD"}' localhost:9098 Currency/GetRate
{
  "rate": 5.37
}

{ "Base" : "BRL", "Destination" : "USD" }

{ "Base" : "BRL", "Destination" : "EUR" }

grpcurl --plaintext -d @ localhost:9098 Currency/SubscribeRates

grpcurl --plaintext localhost:9098 HealthCheck/Check

FAQs

Package last updated on 16 Aug 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc