GopherCon 2019: Mat Ryer - How I Write HTTP Web Services after Eight Years

  Рет қаралды 72,719

Gopher Academy

Gopher Academy

Күн бұрын

A look at how Mat Ryer builds web services after doing so for the past eight years. Extremely practical, tried and tested patterns that everybody can start using today.

Пікірлер: 36
@MohammedKamil
@MohammedKamil 11 ай бұрын
This is the most approachable talk/talker I've seen, kodus
@VitalyZdanevich
@VitalyZdanevich 3 жыл бұрын
Thank you for dark slides.
@codeconcept
@codeconcept 5 ай бұрын
Still very valuable in 2024. Thanks Mat 😀
@nmezhenskyi
@nmezhenskyi 2 жыл бұрын
Great presentation! I keep coming to this video quite often.
@karlpokus
@karlpokus 4 жыл бұрын
Great talk! Thanks for sharing Mat!
@spencerlong2745
@spencerlong2745 2 жыл бұрын
Wow, what an awesome talk, cheers Mat.
@inaccessiblecardinal9352
@inaccessiblecardinal9352 3 ай бұрын
Excellent talk. Keeping it clean and simple.
@david.budnick
@david.budnick 2 жыл бұрын
Great talk, thanks for sharing!
@edwingarcia5043
@edwingarcia5043 2 жыл бұрын
From this I learned many things, thanks 👍🏽
@vaskir3695
@vaskir3695 3 жыл бұрын
Great talk, thanks.
@cgossain
@cgossain Жыл бұрын
Really great talk!
@nodidog
@nodidog 3 ай бұрын
Love the defer goodbye() straight after hello() 😂
@MrChickenpoulet
@MrChickenpoulet 3 жыл бұрын
what a nice talk!
@SouvikHaldarmustang
@SouvikHaldarmustang 8 ай бұрын
This is my de-facto standard for building APIs.
@ismaelgrahms
@ismaelgrahms Жыл бұрын
Great advices
@noli-timere-crede-tantum
@noli-timere-crede-tantum 3 жыл бұрын
"Although, Packt" hahaha - I hear ya, bruh. One blog post and one demo video on KZbin, and next thing you know, I have two book on Packt :)
@VitalyZdanevich
@VitalyZdanevich 3 жыл бұрын
Put URL of the blog post to the description.
@maheshkottapalli6945
@maheshkottapalli6945 3 жыл бұрын
Thank you very much.....
@Violaphobia
@Violaphobia 4 жыл бұрын
This video is great, but as a real newby to Golang I'm confused on a few points. At 27:55, what does this accomplish? Are these structs used inside the handler function somewhere?
@CR7Ashironaldo
@CR7Ashironaldo 4 жыл бұрын
the request struct is used to unmarshall the request body of the request, the response struct to fill the response and then encode it in json and write to response writer, they will be used by that returned HandlerFunc.
@asfaltboy
@asfaltboy 4 жыл бұрын
This is a common practice when writing an API endpoint, to take a serialized request and return a serialized response (e.g a JSON string in the body), and mapping these to structs and doing validation and deserialization once before handling business logic. Here's an example some might find useful: www.alexedwards.net/blog/how-to-properly-parse-a-json-request-body
@arhyth
@arhyth 4 жыл бұрын
if not in constructor, where does one setup the server dependencies then? especially dependencies that need to be mocked up in tests. true, having to explicitly provide dependencies is bothersome but it’s the only way i can think of without magic dependencies and untestable behavior.
@epiicSpooky
@epiicSpooky 4 жыл бұрын
You pass them in to the constructor (as mentioned in the talk, only practical if there are just a few), or initialize the server struct directly and assign them later, or create a dependencies public struct that you pass in (e.g. MyServer.New(MyServer.Deps{DB: dbconn, SomeClient: client})). In New(), there is code to do things like setup routes - very specific initialization to your service. You want to run that in your unit tests, and so you don't want to mix in initializing services in there because if you do it's harder/impossible to test. There are some "Clean Code Talks" from about a decade ago here on YT that explain the value of that approach - you don't build a car and expect it to build an engine for itself - you build an engine and a car and give it to the car in your setup. It helps for testability to move initialization as far up the call chain as you can. So your main module usually does a lot of the boring initialization of things, all in one place where all the dependencies are clear. It also simplifies refactoring like he mentioned breaking a big service into separate services. Give the db connection to the small services and give the small services to the main server.
@sergsergesrgergseg
@sergsergesrgergseg 2 жыл бұрын
is there a written version
@liangli6276
@liangli6276 Жыл бұрын
is there any github code example ?
@cs80211
@cs80211 8 ай бұрын
Is there an example code 😢
@nroose
@nroose 5 ай бұрын
Those one letter variable names really bother me for some reason.
@GAMarine137
@GAMarine137 4 жыл бұрын
I highly recommend the Gin framework for REST services
@aleyrizvi
@aleyrizvi Ай бұрын
Not until you reach the point where you have to fight the framework.
GothamGo 2018 - Things in Go I Never Use by Mat Ryer
24:53
Nation Confrences
Рет қаралды 84 М.
Do you have a friend like this? 🤣#shorts
00:12
dednahype
Рет қаралды 57 МЛН
В ДЕТСТВЕ СТРОИШЬ ДОМ ПОД СТОЛОМ
00:17
SIDELNIKOVVV
Рет қаралды 2,5 МЛН
когда достали одноклассники!
00:49
БРУНО
Рет қаралды 4,1 МЛН
1❤️#thankyou #shorts
00:21
あみか部
Рет қаралды 12 МЛН
THIS is the BEST Way to Write HTTP Services in Golang
13:53
GopherCon 2019: Marwan Sulaiman - Handling Go Errors
31:55
Gopher Academy
Рет қаралды 24 М.
How I build APIs capable of gigantic scale in Go - Mat Ryer
41:19
GopherCon 2019: Elena Morozova - How Uber Goes
23:31
Gopher Academy
Рет қаралды 21 М.
iPhone 12 socket cleaning #fixit
0:30
Tamar DB (mt)
Рет қаралды 21 МЛН
wyłącznik
0:50
Panele Fotowoltaiczne
Рет қаралды 24 МЛН
Индуктивность и дроссель.
1:00
Hi Dev! – Электроника
Рет қаралды 1,6 МЛН
📱 SAMSUNG, ЧТО С ЛИЦОМ? 🤡
0:46
Яблочный Маньяк
Рет қаралды 1,9 МЛН