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

github.com/fzft/go_microservice/currency

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/fzft/go_microservice/currency

  • v0.0.0-20201011065641-084b5092d7b2
  • Source
  • Go
  • Socket score

Version published
Created
Source

Currency Service

The currency service is a gRPC service which provides up to date exchange rates and currency conversion capabilities.

Building protos

To build the gRPC client and server interfaces, first install protoc:

Linux

sudo apt install protobuf-compiler

Mac

brew install protoc

Then install the Go gRPC plugin:

go get google.golang.org/grpc

Then run the build command:

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

Testing

To test the system install grpccurl which is a command line tool which can interact with gRPC API's

https://github.com/fullstorydev/grpcurl

go install github.com/fullstorydev/grpcurl/cmd/grpcurl

List Services

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

List Methods

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

Method detail for GetRate

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

RateRequest detail

grpcurl --plaintext localhost:9092 describe .RateRequest    
RateRequest is a message:
message RateRequest {
  string Base = 1 [json_name = "base"];
  string Destination = 2 [json_name = "destination"];
}

Execute a request

grpcurl --plaintext -d '{"base": "GBP", "destination": "USD"}' localhost:9092 Currency/GetRate
{
  "rate": 0.5
}

FAQs

Package last updated on 11 Oct 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