Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Unlocking net/http APIs (Kaylyn Gibilterra 2019)
Search
GopherConAU
October 31, 2019
Programming
35
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Unlocking net/http APIs (Kaylyn Gibilterra 2019)
GopherConAU
October 31, 2019
Transcript
51 slides
Unlocking net/http APIs Kaylyn Gibilterra - @kgibilterra Capital One @egonelbre
None
None
None
Part 1 - Basic API Part 2 - Building a
Router Part 3 - Router Extensions
None
1. 2.
Line 1 http.HandleFunc("/hello", hello)
What is a handler?
What is a handler?
What is a handler?
What is a handler?
What is a handler?
What is HandlerFunc?
Line 2 http.ListenAndServe(":8080", nil)
What is a Server?
1. 2.
0.
What is a ServeMux?
Creating more complex routes
Part 2 - Building a Router
Get all salutations
Get all salutations
Get all salutations
Get one salutation
Get one salutation
HTTP Requests
HTTP Requests
salutationsRouter()
Get one salutation
Create new language
Create new language
Create new language
Phase 3 - Router Extensions
Parsing multiple parameters
Parsing a query parameter
Adding middleware
Passing a parameter through context
None
Thank You Kaylyn Gibilterra - @kgibilterra Capital One @egonelbre
What is a ServeMux?
What is a ServeMux?
What is a handler?
What is a handler?
What is a handler?
Longer patterns are matched first
“/” matches all non-registered patterns
ServeMux will redirect subtree root matches
Host-specific patterns take precedence over general
URL request path and Host header sanitizing
Things I could talk about: • Building an API ◦
Handlers ◦ ListenAndServe ◦ Mux & routing ◦ Request ◦ Restricting Methods ◦ Response ◦ Parsing a request: ▪ Json unmarshal ▪ Reading a body • Calling an API ◦ Client: https://medium.com/@nate 510/don-t-use-go-s-default- http-client-4804cb19f779 ◦ Server • Transport - TLS, setting proxies • CORS • Interfaces • Context • Middleware • Testing • http.Error maybe?
More Decks by GopherConAU
See All by GopherConAU
Go for Decimals (Josh Carpeggiani 2019)
gopherconau
0
36
Inclusiveness - It's In Your Hands (Adel Smee 2019)
gopherconau
0
33
Migrate to a New Platform by Creating a Pipeline in Go (Julia Wong 2019)
gopherconau
0
56
The Fyne GUI Toolkit (Steve O'Connor 2019)
gopherconau
0
590
Designing Go Services For Continuous Deployment (Am Laher 2019)
gopherconau
0
39
PDF Full Text Search in Go (Peter Williams 2019)
gopherconau
0
25
Profiling in Production (Alexander Else 2019)
gopherconau
0
81
Getting Started with Deep Learning in Go (Darrell Chua 2019)
gopherconau
0
44
Recommendations That Don't Suck (Gareth Seneque 2019)
gopherconau
0
59
Other Decks in Programming
See All in Programming
あなたはMCPの機能を、まだ知らない。
4geru
1
740
読みやすい!と評判(?)の発表の準備にかける私のこだわり
shoheimitani
0
170
小さなアプリを作って公開するまで
onozaty
0
240
SONY CISC-NEWS NWS-1750 + NWB-225 ハードウェアメンテとフレームバッファカラー対応 / KOF2026
tsutsui
0
130
Rails初心者がパスキーを実装してみて大変だったこと
ktombow
0
240
地方こそサーバーレス — 10年続けた、顔が見えるチームで確かな基盤を / Serverless Matters Most in Regional Areas — 10 Years of Building Reliable Foundations with Close-Knit Teams
seike460
PRO
2
520
コード生成時代のAPI定義を支えるRequest Spec移行
pvcresin
0
300
AIエージェントの「テストは通るのに本番で壊れる」を減らす
shibuiwilliam
3
120
Goコンパイラを作ってGoをもっと理解する / Build a Go compiler to better understand Go
ikura_hamu
0
140
JavaScriptはシングルバイナリの夢を見るか / Does JavaScript Dream of a Single Binary?
ssssota
0
170
Kotlin Fest 2026: Kotlin コンパイラに Contribute してみよう! - Kotlin/Wasm で深い再帰を書けるようにした話
ternbusty
1
420
クラウドゲーミングのパフォーマンス最適化に挑む / Cloud Gaming Performance Tuning
vivion
0
360
Featured
See All Featured
Building Better People: How to give real-time feedback that sticks.
wjessup
371
20k
Faster Mobile Websites
deanohume
310
32k
Code Review Best Practice
trishagee
74
20k
Site-Speed That Sticks
csswizardry
13
1.6k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.6k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.7k
Producing Creativity
orderedlist
PRO
348
41k
Why Our Code Smells
bkeepers
PRO
340
58k
Typedesign – Prime Four
hannesfritz
42
3.2k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
340
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
A Soul's Torment
seathinner
9
3.9k