this post was submitted on 02 Sep 2024
220 points (98.2% liked)
Programming
17417 readers
38 users here now
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Rules
- Follow the programming.dev instance rules
- Keep content related to programming in some way
- If you're posting long videos try to add in some form of tldr for those who don't want to watch videos
Wormhole
Follow the wormhole through a path of communities !webdev@programming.dev
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
GRPC for building APIs instead of REST. Type safety makes life easier
I mean, REST-ful JSON APIs can be perfectly type-safe, if their developers actually take care to make them that way. And the self-descriptive nature of JSON is arguably a benefit in really large public-facing APIs. But yeah, gRPC forces a certain amount of type-safety and version control, and gRPC with protobuf is SUCH a pleasure to work with.
Give it time, though, it's definitely gaining traction.
The biggest problems with gRPC are:
Plain HTTP can be type safe. Just publish JSON schema or Typespec files or even use Protobuf.
Am I the only one who is weirded out? Requiring a web server for something and then requiring another server if you want it to actually work on the web?
How expensive do people want to make their deployments?
Your concerns are all valid, but about 1 and 3 there are possible solutions. I'm using Rust+Tonic to build an API and that's eliminate the necessity of proxies and it's very simple to use.
I know that it don't solve all problems, but IMHO is a question of adoption. Easier ~~told~~ tools will be develop for it.
It's the recommended approach to replace WCF which was deprecated after .NET framework 4.8. My company is just now getting around to ripping out all their WCF stuff and putting in gRPC. REST interfaces were always a non-starter because of how "heavyweight" they were for our use case (data collection from industrial devices which are themselves data collectors).
I like the concept and I think the use case is almost covered by generating API client through generated OpenAPI spec.
It's needs a bit of setup but a client library can be built whenever a backend server is built.