1. 11
  1. 4

    This actually looks really nice.

    1. 2

      Thanks Peter! There’s a few obvious improvements (configuration of the message format, a more general way of handling how the incoming request is handled – support GET, etc) but I also like that it’s small, simple, and opinionated, as it evolved from a fairly simple use-case. This is my first use of generics in Go, and I really like how I was able to link the handler functions to the dependency type on the server struct to allow you to inject whatever your handlers need to do their work. It’s a good use of generics there, I think.

    2. 1

      I really like the simple approach this project takes! Out of curiosity, have you thought about a way to validate the query via a schema or some kind of IDL?

      EDIT: Is it possible to use another format than JSON, like MessagePack for example?

      1. 2

        That’s a good suggestion. For now it’s a case of “do the simplest thing that works”, so there are a few improvements that could still be added. Regarding MessagePack, it’d be easy to swap out the handling of the command JSON to use MessagePack, but you’d need to fork for that. I’ve not abstracted that logic to be swapped out. I’ll have a think about that though!

        1. 1

          Thank you very much for this information, I will follow your project! :-)

          EDIT: GitHub displays indentations with too many spaces, so I suggest to use spaces instead for the examples in the README.md, it would probably be more readable!