Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Building Great APIs With gRPC - GoLab 2018

Building Great APIs With gRPC - GoLab 2018

It generally takes lots of time and decisions to create an HTTP API, but when you want to get productive fast, you want to skip as many steps as possible. I’ve been working with gRPC for almost a year and I can guide you from first lines of the code up to request tracking or exposing it via HTTP.

When you want to build a usable API these days, you immediately think about creating an HTTP server and you start from there. You may want to use a standard library or a handful of popular libraries that help you with that. What if I told you that there is an alternative? With gRPC you can build fast, elegant and reliable solutions which, in the end, could also be exposed via standard HTTP server. I would like to guide you from the first steps, through various levels of compexity, to request tracking while mainaining an elegant, readable and testable codebase.

Paweł Słomka

October 23, 2018
Tweet

More Decks by Paweł Słomka

Other Decks in Technology

Transcript

  1. @pawel_slomka ABOUT ME • Blogger at mycodesmells.com • Go developer

    at Ingrid • Co-organizer of GoWroc meetup • Runner ! • Millenial @pawel_slomka
  2. @pawel_slomka HTTP/2 & TLS HTTP/2 does not enforce TLS, but

    all major browsers decided not to support it for insecure connections. Go automatically upgrades to HTTP/2 if you run your servers with TLS. gRPC does not require TLS, but it’s better be safe than sorry, we’ll use it anyway!
  3. @pawel_slomka Why HTTP? • While gRPC is cool, it’s not

    that popular (yet?) • Clients still prefer HTTP API • Need for automatic translation • github.com/grpc-ecosystem/grpc-gateway
  4. @pawel_slomka Need for docs • Having an API is not

    enough • Generating Swagger (JSON) • Swagger UI
  5. @pawel_slomka Next steps • Not everyone is using Go •

    Make life easier for the QA • Generate client code eg. in Python?
  6. @pawel_slomka What we did (1/3) • Started with simple protobuf

    declarations and • Generated Go code • Server stubs • Working client code
  7. @pawel_slomka What we did (3/3) • With Postman • Allow

    QA use our API • Generated client in Python