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
@MohammedKamil11 ай бұрын
This is the most approachable talk/talker I've seen, kodus
@VitalyZdanevich3 жыл бұрын
Thank you for dark slides.
@codeconcept5 ай бұрын
Still very valuable in 2024. Thanks Mat 😀
@nmezhenskyi2 жыл бұрын
Great presentation! I keep coming to this video quite often.
@karlpokus4 жыл бұрын
Great talk! Thanks for sharing Mat!
@spencerlong27452 жыл бұрын
Wow, what an awesome talk, cheers Mat.
@inaccessiblecardinal93523 ай бұрын
Excellent talk. Keeping it clean and simple.
@david.budnick2 жыл бұрын
Great talk, thanks for sharing!
@edwingarcia50432 жыл бұрын
From this I learned many things, thanks 👍🏽
@vaskir36953 жыл бұрын
Great talk, thanks.
@cgossain Жыл бұрын
Really great talk!
@nodidog3 ай бұрын
Love the defer goodbye() straight after hello() 😂
@MrChickenpoulet3 жыл бұрын
what a nice talk!
@SouvikHaldarmustang8 ай бұрын
This is my de-facto standard for building APIs.
@ismaelgrahms Жыл бұрын
Great advices
@noli-timere-crede-tantum3 жыл бұрын
"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 :)
@VitalyZdanevich3 жыл бұрын
Put URL of the blog post to the description.
@maheshkottapalli69453 жыл бұрын
Thank you very much.....
@Violaphobia4 жыл бұрын
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?
@CR7Ashironaldo4 жыл бұрын
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.
@asfaltboy4 жыл бұрын
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
@arhyth4 жыл бұрын
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.
@epiicSpooky4 жыл бұрын
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.
@sergsergesrgergseg2 жыл бұрын
is there a written version
@liangli6276 Жыл бұрын
is there any github code example ?
@cs802118 ай бұрын
Is there an example code 😢
@nroose5 ай бұрын
Those one letter variable names really bother me for some reason.
@GAMarine1374 жыл бұрын
I highly recommend the Gin framework for REST services
@aleyrizviАй бұрын
Not until you reach the point where you have to fight the framework.