mozey / httprouter-util

Example of using httprouter and other useful packages
2 stars 0 forks source link

Browser and gRPC-compatible HTTP APIs #4

Closed mozey closed 1 year ago

mozey commented 1 year ago

Protocol buffer is an alternative to tools like Swagger.

Besides the benefits of using a binary protocol, it's potentially also more efficient to develop. The "spec" / clients are generated from interfaces and structs, no comment annotations, or manually editing JSON spec is required.

connect-go is an alternative lib for "for building browser and gRPC-compatible HTTP APIs. If you're tired of hand-written boilerplate and turned off by massive frameworks, Connect is for you.". It has the following features

The official Google implementation of gRPC has some disadvantages

As per gotime episode gRPC & protocol buffers

mozey commented 1 year ago

Related to https://github.com/mozey/httprouter-example/issues/3

mozey commented 1 year ago

Implementing in https://github.com/mozey/httprouter-example/pull/5

mozey commented 1 year ago

Tool for generating a TypeScript client: connect-web

mozey commented 1 year ago

See protobuf language spec

UPDATE Leaning above spec is not that practical. Stick to using Go structs and swagger annotations on the route handlers as in #3