restful apis in go
play

RESTFUL APIS IN GO Frankfurter Entwicklertag 2018 Ralf Wirdemann - PowerPoint PPT Presentation

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 @


  1. 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. � 2 / 17 [ GitPitch @ bitbucket/rwirdemann/rest-apis-go-md/frankfurter-entwicklertag-2018 ]

  3. GO 101 � 3 / 17 [ GitPitch @ bitbucket/rwirdemann/rest-apis-go-md/frankfurter-entwicklertag-2018 ]

  4. 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 ]

  5. 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 ]

  6. 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 ]

  7. 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 ]

  8. CROSS PLATFORM-BINARIES � 8 / 17 [ GitPitch @ bitbucket/rwirdemann/rest-apis-go-md/frankfurter-entwicklertag-2018 ]

  9. STANDARD LIBRARY � 9 / 17 [ GitPitch @ bitbucket/rwirdemann/rest-apis-go-md/frankfurter-entwicklertag-2018 ]

  10. NET/HTTP Package http provides HTTP client and server implementations. � 10 / 17 [ GitPitch @ bitbucket/rwirdemann/rest-apis-go-md/frankfurter-entwicklertag-2018 ]

  11. 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 ]

  12. 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 ]

  13. 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 ]

  14. REST 101 Architecture Style Resourcen URIs HTTP-Verbs Representations Hypermedia � 14 / 17 [ GitPitch @ bitbucket/rwirdemann/rest-apis-go-md/frankfurter-entwicklertag-2018 ]

  15. RESOURCE EXAMPLE � 15 / 17 [ GitPitch @ bitbucket/rwirdemann/rest-apis-go-md/frankfurter-entwicklertag-2018 ]

  16. � 16 / 17 [ GitPitch @ bitbucket/rwirdemann/rest-apis-go-md/frankfurter-entwicklertag-2018 ]

  17. GO PAIR PROGRAMMING ralf.wirdemann@kommitment.biz � 17 / 17 [ GitPitch @ bitbucket/rwirdemann/rest-apis-go-md/frankfurter-entwicklertag-2018 ]

Recommend


More recommend