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

restful apis in go
SMART_READER_LITE
LIVE PREVIEW

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 @


slide-1
SLIDE 1

RESTFUL APIS IN GO

Frankfurter Entwicklertag 2018 Ralf Wirdemann

Navigate : Space / Arrow Keys |

  • Menu | - Fullscreen | - Overview | - Blackout | - Speaker | - Help

M F O B S ?

  • 1 / 17
slide-2
SLIDE 2 [ GitPitch @ bitbucket/rwirdemann/rest-apis-go-md/frankfurter-entwicklertag-2018 ]
  • 2 / 17
slide-3
SLIDE 3

GO 101

[ GitPitch @ bitbucket/rwirdemann/rest-apis-go-md/frankfurter-entwicklertag-2018 ]
  • 3 / 17
slide-4
SLIDE 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)

[ GitPitch @ bitbucket/rwirdemann/rest-apis-go-md/frankfurter-entwicklertag-2018 ]
  • 4 / 17
slide-5
SLIDE 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

[ GitPitch @ bitbucket/rwirdemann/rest-apis-go-md/frankfurter-entwicklertag-2018 ]
  • 5 / 17
slide-6
SLIDE 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) }

[ GitPitch @ bitbucket/rwirdemann/rest-apis-go-md/frankfurter-entwicklertag-2018 ]
  • 6 / 17
slide-7
SLIDE 7

WELL, I'M OO TOO

type Rectangle struct { size int border int } func (this Rectangle) draw() { } r := Rectangle{} r.draw()

[ GitPitch @ bitbucket/rwirdemann/rest-apis-go-md/frankfurter-entwicklertag-2018 ]
  • 7 / 17
slide-8
SLIDE 8

CROSS PLATFORM-BINARIES

[ GitPitch @ bitbucket/rwirdemann/rest-apis-go-md/frankfurter-entwicklertag-2018 ]
  • 8 / 17
slide-9
SLIDE 9

STANDARD LIBRARY

[ GitPitch @ bitbucket/rwirdemann/rest-apis-go-md/frankfurter-entwicklertag-2018 ]
  • 9 / 17
slide-10
SLIDE 10

NET/HTTP

Package http provides HTTP client and server implementations.

[ GitPitch @ bitbucket/rwirdemann/rest-apis-go-md/frankfurter-entwicklertag-2018 ]
  • 10 / 17
slide-11
SLIDE 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))

[ GitPitch @ bitbucket/rwirdemann/rest-apis-go-md/frankfurter-entwicklertag-2018 ]
  • 11 / 17
slide-12
SLIDE 12

ENCODING/JSON

Package json implements encoding and decoding of JSON as defined in RFC 4627.

[ GitPitch @ bitbucket/rwirdemann/rest-apis-go-md/frankfurter-entwicklertag-2018 ]
  • 12 / 17
slide-13
SLIDE 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"}

[ GitPitch @ bitbucket/rwirdemann/rest-apis-go-md/frankfurter-entwicklertag-2018 ]
  • 13 / 17
slide-14
SLIDE 14

REST 101

Architecture Style Resourcen URIs HTTP-Verbs Representations Hypermedia

[ GitPitch @ bitbucket/rwirdemann/rest-apis-go-md/frankfurter-entwicklertag-2018 ]
  • 14 / 17
slide-15
SLIDE 15

RESOURCE EXAMPLE

[ GitPitch @ bitbucket/rwirdemann/rest-apis-go-md/frankfurter-entwicklertag-2018 ]
  • 15 / 17
slide-16
SLIDE 16 [ GitPitch @ bitbucket/rwirdemann/rest-apis-go-md/frankfurter-entwicklertag-2018 ]
  • 16 / 17
slide-17
SLIDE 17

GO PAIR PROGRAMMING

ralf.wirdemann@kommitment.biz

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