Creating Vue middleware
Working with Vue (and Axios) and Golang, we’ve shown we can bring all of learning so far all together, but we’ve missed one small aspect. We’ve deliberately omitted the JSON struct
tags from our Golang code. If we add them back into our backend/server.go
and rerun both the server and app, our requests no longer work!
func appPOST() http.HandlerFunc { type RequestBody struct { InboundMsg string `json:"inbound_msg,omitempty"` } type ResponseBody struct { OutboundMsg string `json:"outbound_msg,omitempty"` } ...
Our frontend and backend can no longer communicate as the contract has changed; the frontend is communicating in CamelCase, while the backend is communicating in snake_case.
This isn’t a show-stopper, as we’...