Build Your First Rest API with GO
There is three part to this workshop.
API
Rest API
Rest API with GO
API
If you have bee...
For further actions, you may consider blocking this person and/or reporting abuse
Hey @moficodes ! I wanted to thank you for the article. It works as a great bridge between some of the more terse tutorials and examples out there and winding up with a working SPA+API running on Go.
So, thanks for the work you put in ! I greatly appreciate it.
I am glad you liked it. 🥰
Great primer for writing REST APIs in golang. I am a go newbie and stumbled on to this article. Quick note about some of the example code for typo fix or for anyone else working through the example:
The beginning of the exercise has the w.WriteHeader and w.Header().Set lines flip-flopped.
while running the example at the beginning I kept getting "text/plain" for my response content type instead of "application/json". It looks to be correct elsewhere but w.Header().Set should be called before w.WriteHeader. According to docs: "Changing the header map after a call to WriteHeader (or Write) has no effect unless the modified headers are trailers".
Thanks for catching that.
Fixed it.
There's a typo on this line:
Should be:
is my mux router. api is a subrouter on r.
In this example using api instead of r would work.
But if i have other routes on r this would not work.
Oops, good point. I think I hadn't used api yet and it was complaining about that.
one of the "best worst" feature of go. :D
I'd more concern about the following area
Api-doc generation ( go-swagger? )
The limit or rate control relate stuff.
How things integrate with auth token ( jwt stuff ).
Excellent article. Much appreciated!
good one, it helped!
thanks
zen
Thanks for the excellent tutorial.
really awesome dude
bro thanks for the article however why did u did not add any code in the stuct called server initially ??
You are talking about this part I believe.
For http.Handle it just needs some type that implements the handler interface.
For example, this below is valid code.
New to go lang. What an article hats off 🙇