RESTFUL APIS IN GO Frankfurter Entwicklertag 2018 Ralf Wirdemann � Navigate : Space / Arrow Keys | M - Menu | - Fullscreen | - Overview | - Blackout | - Speaker | - Help F O B S ? 1 / 17
� 2 / 17 [ GitPitch @ bitbucket/rwirdemann/rest-apis-go-md/frankfurter-entwicklertag-2018 ]
GO 101 � 3 / 17 [ GitPitch @ bitbucket/rwirdemann/rest-apis-go-md/frankfurter-entwicklertag-2018 ]
STATICALLY TYPED var i int s := "Hallo" // string f := 3.142 // float type struct Product { Id int Name string } p := Product{1, "Schuhe"} foo(p) � 4 / 17 [ GitPitch @ bitbucket/rwirdemann/rest-apis-go-md/frankfurter-entwicklertag-2018 ]
SMALL: ONLY 25 KEYWORDS break default var interface select case defer go map struct chan else goto package switch const fallthrough if range type continue for import return func � 5 / 17 [ GitPitch @ bitbucket/rwirdemann/rest-apis-go-md/frankfurter-entwicklertag-2018 ]
LOOK, I'M FUNCTIONAL func bar(x int) bool { return x == 42 } func foo(f func (x int) bool) bool { return f(42) } func main() { foo(bar) } � 6 / 17 [ GitPitch @ bitbucket/rwirdemann/rest-apis-go-md/frankfurter-entwicklertag-2018 ]
WELL, I'M OO TOO type Rectangle struct { size int border int } func (this Rectangle) draw() { } r := Rectangle{} r.draw() � 7 / 17 [ GitPitch @ bitbucket/rwirdemann/rest-apis-go-md/frankfurter-entwicklertag-2018 ]
CROSS PLATFORM-BINARIES � 8 / 17 [ GitPitch @ bitbucket/rwirdemann/rest-apis-go-md/frankfurter-entwicklertag-2018 ]
STANDARD LIBRARY � 9 / 17 [ GitPitch @ bitbucket/rwirdemann/rest-apis-go-md/frankfurter-entwicklertag-2018 ]
NET/HTTP Package http provides HTTP client and server implementations. � 10 / 17 [ GitPitch @ bitbucket/rwirdemann/rest-apis-go-md/frankfurter-entwicklertag-2018 ]
http.Handle("/foo", fooHandler) func fooHandler(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "Hey, %q", html.EscapeString(r.URL.Path)) } log.Fatal(http.ListenAndServe(":8080", nil)) � 11 / 17 [ GitPitch @ bitbucket/rwirdemann/rest-apis-go-md/frankfurter-entwicklertag-2018 ]
ENCODING/JSON Package json implements encoding and decoding of JSON as defined in RFC 4627. � 12 / 17 [ GitPitch @ bitbucket/rwirdemann/rest-apis-go-md/frankfurter-entwicklertag-2018 ]
type Message struct { Name string Body string } m := Message{"Alice", "Hello"} b, err := json.Marshal(m) b == []byte(`{"Name":"Alice","Body":"Hello"}`) var n Message err := json.Unmarshal(b, &n) n == Message{Name: "Alice", Body: "Hello"} � 13 / 17 [ GitPitch @ bitbucket/rwirdemann/rest-apis-go-md/frankfurter-entwicklertag-2018 ]
REST 101 Architecture Style Resourcen URIs HTTP-Verbs Representations Hypermedia � 14 / 17 [ GitPitch @ bitbucket/rwirdemann/rest-apis-go-md/frankfurter-entwicklertag-2018 ]
RESOURCE EXAMPLE � 15 / 17 [ GitPitch @ bitbucket/rwirdemann/rest-apis-go-md/frankfurter-entwicklertag-2018 ]
� 16 / 17 [ GitPitch @ bitbucket/rwirdemann/rest-apis-go-md/frankfurter-entwicklertag-2018 ]
GO PAIR PROGRAMMING ralf.wirdemann@kommitment.biz � 17 / 17 [ GitPitch @ bitbucket/rwirdemann/rest-apis-go-md/frankfurter-entwicklertag-2018 ]
Recommend
More recommend