Replies: 2 comments 1 reply
-
Oh, I see the example app here, it just creates an additional field on the response: https://github.com/goadesign/examples/tree/master/cookies |
Beta Was this translation helpful? Give feedback.
-
Yes, just to step back a bit: the idea is that method request payload and result are defined independently of the transport. A method accepts a given data structure and returns another well defined data structure (or optionally errors). All of this is true no matter how that method is being called. Then the Goa DSL makes it possible to define how these data structures are initialized (server requests or client responses) or serialized (server responses or client requests) for a given transport (HTTP or gRPC at this point). The HTTP DSL says "read this field from a cookie - or - serialize this field into a cookie. This approach makes for a much cleaner architecture where transport concerns are completely decoupled from the underlying HTTP details. Practically speaking it makes it simple to change transport details without changing any business logic (e.g. instead of writing a cookie if you needed to write a header it would be a one line change in the design - no change at all in the implementation). It also makes it possible to completely switch the underlying transport or add support for a new transport (switch from/to HTTP and gRPC) without changing any implementation code. |
Beta Was this translation helpful? Give feedback.
-
How can I set the value of a cookie in GOA? GOA takes away the ability to write to a response.
The docs on cookies point to the DSL. The DSL documents how to talk about cookies in the API, but gives no additional code samples outside of the API descriptors. I looked through the repo and can't find anything about this.
It seems as if these cookies only meant to have their value set by something in the payload- which is an odd concept to me to begin with and certainly doesn't match my use case.
Beta Was this translation helpful? Give feedback.
All reactions