Go API Tutorial - Make An API With Go

แชร์
ฝัง
  • เผยแพร่เมื่อ 31 ม.ค. 2025

ความคิดเห็น • 125

  • @mechwarrior83
    @mechwarrior83 2 ปีที่แล้ว +20

    I love the fact that you leave your mistakes in. It shows us that even super human programmers make mistakes, gives me a chance to pause and take a stab at the issue, and finally you break down your thought process behind the troubleshooting.

    • @ValmisFilm
      @ValmisFilm 4 หลายเดือนก่อน

      I disagree. It annoyed me a lot, that I had to learn it the wrong way and then fix it. I think he should prepare better and not make mistakes. I do not need to see how human he is but I need a good video. And making mistakes is not good, it´s bad planning of the video.

    • @foeyloozer6299
      @foeyloozer6299 4 หลายเดือนก่อน

      @@ValmisFilmI like when they include the errors AFTER teaching you the correct way. Sort of a “common mistakes” section after the right way with examples for different scenarios.

    • @ValmisFilm
      @ValmisFilm 4 หลายเดือนก่อน

      @@foeyloozer6299 well like this you could fill it with attentional errors if you take this as a good way to learn. I think it would be much better to make a separate video about typical errors. Makes more sense to me (I am also a teacher). I want to see the correct solution, in an optimized edited video, taht would waste as little time as possible for me. To support my claim - if you pay in Udemy or something like that - no one will give you videos with mistakes.

  • @hmshuvo2332
    @hmshuvo2332 3 ปีที่แล้ว +29

    Perfect place to go for GO for the first time!

  • @Moccar
    @Moccar 3 ปีที่แล้ว +14

    Great tutorial, Tim (as always!). It's good to see some tutorials that are not just going over basic syntax. This is still very simple but it illustrate a real world example!

  • @luciaravazzi6925
    @luciaravazzi6925 3 ปีที่แล้ว +27

    Reaaaally cool! Thanks ✌ Guys, pay attention to the terminal: he is using CMD to execute the curl commands! It doesn't work out using the power shell

    • @cigetbudi
      @cigetbudi 2 ปีที่แล้ว +1

      yeah i have tried it first lol

    • @jacksonwachira6706
      @jacksonwachira6706 2 ปีที่แล้ว +2

      You saved a life here. I was pretty frustrated.

    • @manishkrsingh7684
      @manishkrsingh7684 ปีที่แล้ว

      Thanks for this comment.... it really saved me

    • @MrCleverOnion
      @MrCleverOnion ปีที่แล้ว

      No sh*t genius. Thanks for stating the obvious

    • @theroza31
      @theroza31 8 หลายเดือนก่อน

      @@MrCleverOnion found the biden supporter

  • @grantwells16
    @grantwells16 3 ปีที่แล้ว +18

    GO is so sick. Would love to see an advanced tutorial

  • @ch0wderz912
    @ch0wderz912 2 ปีที่แล้ว +5

    I wished I didn't pick this language but it's so cool and really powerful.
    When you understand the concepts it's pretty easy to pick up!
    Thanks for teaching sir!

    • @efehanturhan6763
      @efehanturhan6763 2 ปีที่แล้ว

      why did you say that bro, i were planning to learn and master go

    • @ch0wderz912
      @ch0wderz912 2 ปีที่แล้ว +2

      @@efehanturhan6763 it depends on what you wanna do with the language, Go is good for blockchain and networking. I didn’t think it was fun so I decided to learn C# for gaming. Idk I’m just lost right now due to the fact what job role I want.

  • @horizonariondust576
    @horizonariondust576 ปีที่แล้ว

    Been looking for a simple yet clear and concise tutorial to learn Go then found your channel, It's perfect!
    My homework now is to read about pointer, what does it do and why do we need it on Go? I'm using C# and I'm a bit confuse for what is that for
    Thanks a lot, Tim!

  • @timothyn4699
    @timothyn4699 11 หลายเดือนก่อน

    got more out of the video then expected, helps clarify a lot of the little details and what gin is doing. Thanks!

  • @JohnBoen
    @JohnBoen 3 ปีที่แล้ว +2

    Excellent demonstration of some key features. I've never played with GO before - I never thought about it as anything more than a wrapper language for deployments and such...
    Thanks for opening my eyes. I think I will be trying my hand at a Go web page this weekend.

  • @LassePhlipsson
    @LassePhlipsson 2 ปีที่แล้ว +2

    Thanks for this tutorial. That is a really great start to get the basics and continue from here!

  • @chrisjarvis509
    @chrisjarvis509 8 หลายเดือนก่อน +1

    Great video! Mistakes are the best ways to learn... glad you kept them in

  • @lucasfe3436
    @lucasfe3436 ปีที่แล้ว

    I could learn many things, thanks Tim. I hope that you launch new videos about GO which is a great programming language

  • @myschored
    @myschored ปีที่แล้ว

    Short and simple tutorial. Great works Tim!

  • @gshan994
    @gshan994 3 ปีที่แล้ว +7

    Go is best suited for backend infra...and recently AWS released aws cdk support for GO.

  • @chem826
    @chem826 3 ปีที่แล้ว +6

    Need more golang tutorials, thank you sir!

  • @professor1429
    @professor1429 ปีที่แล้ว

    Thanks!

  • @gogopher1093
    @gogopher1093 2 ปีที่แล้ว +1

    I'd love to see more Go tutorials! Concurrency, databases, etc.

  • @wosomek
    @wosomek 18 วันที่ผ่านมา

    much love from VietNam, thank u for the good tutorial

  • @chorinaelapin
    @chorinaelapin 10 หลายเดือนก่อน

    謝謝!

  • @nitin_puranik
    @nitin_puranik ปีที่แล้ว

    Loved this tutorial, very helpful! Thanks, Tim. The only thing I didn't quite follow was why you used router.PATCH at 33:05 - didn't quite get the rationale behind when to use PATCH versus POST.

    • @madhavan_vj
      @madhavan_vj ปีที่แล้ว

      Post is not idempotent i.e will create duplicate resources instead of updating the existing one.

  • @youngscientistacademy7689
    @youngscientistacademy7689 3 ปีที่แล้ว +1

    Another seriously great tutorial...... thanks Tim

  • @busyatyoutube
    @busyatyoutube 7 หลายเดือนก่อน

    great video like the way you explained the api calls it makes easy to me

  • @jamesmwangi2491
    @jamesmwangi2491 2 ปีที่แล้ว +1

    simple and straight foward.

  • @bavan1358
    @bavan1358 3 ปีที่แล้ว

    thank you so much,i was actually searching for this.please make more videos of golang

  • @Syed-kr6hd
    @Syed-kr6hd 5 หลายเดือนก่อน

    Loved it, Thank you

  • @johnxisde
    @johnxisde 2 ปีที่แล้ว

    Thanks for that, Tim!

  • @Tiqqle
    @Tiqqle 2 ปีที่แล้ว

    Thank you for this tutorial

  • @umeshnikam8043
    @umeshnikam8043 2 ปีที่แล้ว

    Excellent demonstration

  • @abdullahraihanbhuiyan2346
    @abdullahraihanbhuiyan2346 2 ปีที่แล้ว

    Nice introduction! Thanks!

  • @shaneoh
    @shaneoh 2 ปีที่แล้ว

    Many thanks Tim.

  • @ezrablack5395
    @ezrablack5395 ปีที่แล้ว +3

    Great video Tim! For anyone else running on MAC, if you get the error zsh: no matches found: localhost:8080/checkout?id=3 then run the curl command like this - curl -s -X PATCH 'localhost:8080/checkout?id=3'

  • @prakarangsa-ngamatong193
    @prakarangsa-ngamatong193 ปีที่แล้ว

    thanks for the tutorial!

  • @ScottKFraley
    @ScottKFraley 2 ปีที่แล้ว +3

    Really curious about why you made the struct'd Id field a string vs. an int or other 'actual' numeric value? :)

    • @rssaiganesh
      @rssaiganesh 2 ปีที่แล้ว

      Late reply, not sure if you already have found the answer, but i believe it's because the id is being used in the GET method of bookById. Can anyone let me know if i am correct in this?

    • @YnjeviYhhei
      @YnjeviYhhei 2 ปีที่แล้ว

      in a real DB it would be an uuid which is a string

    • @chips4real1
      @chips4real1 2 ปีที่แล้ว

      why would u need it to be a number, youre not gonna be adding or subtracting ids from each other

    • @ScottKFraley
      @ScottKFraley 2 ปีที่แล้ว

      @@YnjeviYhhei Not necessarily, but I get your point.

    • @ScottKFraley
      @ScottKFraley 2 ปีที่แล้ว

      @@chips4real1 Takes way less space that way, no? I've NEVER used a string as an ID unless it was in fact a GUID/UUID.
      I mean, I definitely would NOT store a phone number as an actual number because no reason. But I have had plenty of tables that used either an int, or a bigint (long in C#) and again, it's my understanding that numbers take way less space than a string does. (Depending on the length of course. But a short string won't be a good Id for a table unless it's a really small / lookup table or some such.)

  • @thisiscrispin
    @thisiscrispin 2 ปีที่แล้ว

    Amazing, thanks!

  • @pranavsharma7479
    @pranavsharma7479 ปีที่แล้ว +2

    There is no need to use json tags in the book struct as the IndentedJSON fucntion encodes the go structs into json itself.

  • @manishkrsingh7684
    @manishkrsingh7684 ปีที่แล้ว

    Great awesome explanation

  • @beaumontyun3872
    @beaumontyun3872 2 ปีที่แล้ว +4

    Surprisingly I could not use curl to do a PATCH request, whereas it's possible for any other request. It was only available when I used Postman or Insomnia to do the PATCH request, so strange...

    • @gustocoder8900
      @gustocoder8900 7 หลายเดือนก่อน +2

      Unlike with with GET and POST requests, the '?' chartacter in the URL is being interpreted by the shell as a special character eg a wildcard, hence the request will not work as expected. To prevent this; you need to either escape the ? character or put the URL in quotes. So, do it like this:
      curl "localhost:8080/checkout?id=2" --request "PATCH"
      OR
      curl localhost:8080/checkout\?id=2 --request "PATCH"

  • @minhnt.dev05
    @minhnt.dev05 3 หลายเดือนก่อน

    Great video

  • @dipsagungurung4553
    @dipsagungurung4553 3 ปีที่แล้ว +2

    love GO

  • @siyaram4237
    @siyaram4237 ปีที่แล้ว +3

    Great tutorial but, I was expecting you to test the API endpoints on applications like Postman. Apart from that I was hoping you would saperate things in folders like, Struct folders, Controller folders and Repository folders.

    • @MusiQ8dict
      @MusiQ8dict ปีที่แล้ว +1

      Any pointers for videos regarding ehat u asked ? Am a newbie

  • @luciaravazzi6925
    @luciaravazzi6925 3 ปีที่แล้ว

    I'm waiting for assembly tutorial 🤟🤟🤣

    • @raoulkent
      @raoulkent 2 ปีที่แล้ว +1

      Whoah there, calm down Satan

  • @pedromiguel-fs7ux
    @pedromiguel-fs7ux 2 ปีที่แล้ว

    great video, thanks

  • @utkarshpandey491
    @utkarshpandey491 3 ปีที่แล้ว

    Thanks sir very much!! 😇

  • @acronproject
    @acronproject ปีที่แล้ว

    Thanks for this

  • @carshoesch
    @carshoesch 6 หลายเดือนก่อน

    Thanks a lot.

  • @TheChemicalWorkshop
    @TheChemicalWorkshop 3 ปีที่แล้ว

    already got one with quart... but not bad !

  • @ishan_sinha
    @ishan_sinha 2 ปีที่แล้ว +2

    If I am not using gin, how else can I bind the json to the object?

  • @utkangul5674
    @utkangul5674 2 ปีที่แล้ว

    great job!

  • @michelchaghoury870
    @michelchaghoury870 3 ปีที่แล้ว +1

    great vid, google uses golang, but wich framework do they use? do they use gin?

    • @AbhishekBM
      @AbhishekBM 3 ปีที่แล้ว +3

      Knowing Google, they probably use their own framework

  • @jotunros
    @jotunros ปีที่แล้ว

    Why is there a books.Quantity

  • @mehdismaeili3743
    @mehdismaeili3743 10 หลายเดือนก่อน

    Excellent .

  • @jonathanlambrecht5642
    @jonathanlambrecht5642 ปีที่แล้ว

    im just starting, few weeks watching some videos, mainly for deciding my route learning go (not falling for tut hell again as i did learning arduino/pic and it took a lot of time), and what i get from this video is that this is very simple, but i do not undestand what and why the framework is doing whatever it is doing (because i do no get it lol) so i think i need to learn without any framework, the same goes with gorm, yeah pretty straight forward, but i think im going to study postgres too, maybe im wrong or dumb for not getting how this works, idk...any thoughts?

  • @danangjehan9733
    @danangjehan9733 2 ปีที่แล้ว +2

    so why do we need to type "example/" in command go mod init and what exactly "example" is ? 😃

    • @srisudarshan9527
      @srisudarshan9527 หลายเดือนก่อน

      Its just a name. Basically, the go.mod is a list of external dependencies(libraries) used by the application other than the ones in the standard library. So usually people give the app name as the github repo the project is going to live in. But that I your wish. Basically, it tells app about the various packages you are using as well

    • @srisudarshan9527
      @srisudarshan9527 หลายเดือนก่อน

      For example if you have one package called main and another called setup and go.mod name is "myapp", when u import setup into main, the import looks like this - import "myapp/setup"

    • @srisudarshan9527
      @srisudarshan9527 หลายเดือนก่อน

      And if ur using external packages like chi(for routing) it is listed in go.mod file

  • @hachikoi-san3901
    @hachikoi-san3901 2 ปีที่แล้ว

    20:38 Yep you need o specify that is a POST req

  • @NATAR160
    @NATAR160 2 ปีที่แล้ว

    Gin not good for large scale application? Which do u recommend?

  • @flyingzeppo
    @flyingzeppo ปีที่แล้ว

    If anyone is having issues with the PATCH command not working, your curl may be aliased to Invoke-Webrequest. In the terminal, run Remove-item alias:curl and then run the patch command again to checkout a book. I was getting frustrated trying to figure this out, so hope this helps if anyone else is having the same issue.

  • @josephtucker9612
    @josephtucker9612 6 หลายเดือนก่อน

    I had an error that said main() did not exist in the package when it did. The problem was I had to save the file. I had saved it earlier after entering my imports but the imports disappeared due to it not being used. StackOverflow was not helpful on stupid mistakes.

  • @chuibete
    @chuibete 2 ปีที่แล้ว

    Not bad but in the dev process it has documentation and tests ... where are they ... it is important and it miss

  • @yevgeniypak1220
    @yevgeniypak1220 ปีที่แล้ว

    Can someone tell what Go extension for vscode is used in this tutorial? I am using just "Go" extension, but I really hate the way it formats the code on save action and also it replaces spaces for tabes. And the problem is that I can't find the point in extension settings where I can fix these behaviours...

  • @mytralala6474
    @mytralala6474 ปีที่แล้ว

    Hello, which Go extension do you use? My json tags are not showing up.

  • @bhavyavijay0
    @bhavyavijay0 11 หลายเดือนก่อน

    I did not get the Fetch by id part like how did that error got fixed and why it was not sending the error message

  • @टिरंजननकले
    @टिरंजननकले 2 ปีที่แล้ว

    Nice tutorial but won't these frameworks weaken our programming skills?

    • @esper4605
      @esper4605 2 ปีที่แล้ว +3

      That's a question that I've mulled over for a long time! I feel like the more we become dependent on high level abstract tools, the less we need to know of the actual "rules" of writing software that performs specific tasks. At the end of the day, we're telling someone's tools that they wrote to tell someone's tools that they wrote to tell someone's tools (etc etc). I feel like we're hitting a point of fragility. It's VERY important to understand how to use lower level languages in case everything needs to be torn apart and redone from scratch. It's ALWAYS important. This is the "zombie apocalypse" of software development, but it is a true fear I have had for a long while.

    • @johngodoy2929
      @johngodoy2929 ปีที่แล้ว

      @@esper4605 Isn't the goal to just get the problems solved?

  • @riordan381
    @riordan381 2 ปีที่แล้ว

    I dont know what settings to change but on go extension file, when I save a file, it automatically removed all the unused imports.
    I dont know where to turn this off on VSCode

  • @0xk4b1r
    @0xk4b1r ปีที่แล้ว

    amazing

  • @JohnnyBigodes
    @JohnnyBigodes ปีที่แล้ว

    Has everything to be on a single file? Every tutorial I see everything is always on the same file. I want to structure my code, over multple files so, that go doesnt look like spaghetti code.

    • @jotunros
      @jotunros ปีที่แล้ว

      Unfortunately most of his tutorials are like that. I treat it as nothing more than prototyping just so you can quickly "dip your toes in the water" so to speak. You need to actually look for some other resources on design. Most commercial applications will have tons of more work to be done when implementing a single rest service/microservice. I come from Java so a good point of reference is how the Spring Boot Api services are structured.

  • @tegacreatives1673
    @tegacreatives1673 2 ปีที่แล้ว +1

    The splatting operator '@' cannot be used to
    | reference variables in an expression. '@body'
    | can be used only as an argument to a command.
    What does this error mean?

    • @yellowman4173
      @yellowman4173 2 ปีที่แล้ว

      I have the same problem. Did you find a solution for this?

    • @erikolkonen2915
      @erikolkonen2915 2 ปีที่แล้ว

      Same issue for me. Tried using curl.exe instead but no luck yet.

    • @maxwl76
      @maxwl76 ปีที่แล้ว

      I swapped to cmd instead of powershell and it works for me

    • @maxwl76
      @maxwl76 ปีที่แล้ว

      @@yellowman4173 I swapped to cmd instead of powershell and it works for me

    • @maxwl76
      @maxwl76 ปีที่แล้ว

      @@erikolkonen2915 I swapped to cmd instead of powershell and it works for me

  • @shubhampokhriyal8491
    @shubhampokhriyal8491 3 ปีที่แล้ว +1

    Any good course for golang backend??

    • @webfactorysolutions
      @webfactorysolutions 2 ปีที่แล้ว +1

      what do you mean? this is backend

    • @shubhampokhriyal8491
      @shubhampokhriyal8491 2 ปีที่แล้ว

      @@webfactorysolutions no I mean more content like udemy course like that

  • @xineric1734
    @xineric1734 2 ปีที่แล้ว

    great tutorial, but it's easy for me

  • @marilenaarsulescu
    @marilenaarsulescu 7 หลายเดือนก่อน

    it's Lev Tolstoi not Leo Tolstoy

  • @brahmkaransingh8804
    @brahmkaransingh8804 2 ปีที่แล้ว

    Can anybody tell is gin framework a third party package or not ?

  • @arab01001
    @arab01001 ปีที่แล้ว

    10:55

  • @techwithzaitri9458
    @techwithzaitri9458 3 ปีที่แล้ว

    yes

  • @Nellak2011
    @Nellak2011 2 ปีที่แล้ว

    I wish this made sense to me. It is very convoluted.

  • @joinadduk
    @joinadduk 3 ปีที่แล้ว

    1st

  • @aligu7
    @aligu7 3 ปีที่แล้ว

    First

  • @helloworld7796
    @helloworld7796 2 ปีที่แล้ว

    Why almost every tutorial is with gin or some other framework. Why there is no simple go tutorial, without any extra frameworks etc.

  • @ValmisFilm
    @ValmisFilm 4 หลายเดือนก่อน

    so this is the easy? .... this was quite hard to understand. Seriously. It kind of killed my enthusiasm for learning go...

  • @lemmyz1
    @lemmyz1 2 ปีที่แล้ว

    Ahhh this paid promotion thing is so annoying.. it hides content as I'm watching from TV..

  • @FPChris
    @FPChris 2 ปีที่แล้ว

    Ug. Sponsor:(

  • @int-64
    @int-64 2 ปีที่แล้ว

    why are teaching stuff that you dont even know

    • @jessicadowning3170
      @jessicadowning3170 ปีที่แล้ว +4

      It was really helpful for me to see him make mistakes and then go back and explain why he made a mistake. I learned a lot from his video and I'm sure he did too. One of the best ways to solidify something you've learned is to teach it to someone else. If no one ever taught things they hadn't already mastered, there would be a lot less knowledge shared. Don't discourage people from sharing just because you're grumpy.

  • @iamworstgamer
    @iamworstgamer 7 หลายเดือนก่อน

    this is most useless tutorial i have ever seen.

  • @opcon3155
    @opcon3155 3 ปีที่แล้ว

    Great video but Java and Python will always rule over the others

  • @paschalokafor9043
    @paschalokafor9043 ปีที่แล้ว

    @27.58, you could also use c.AbortWithStatudJson. Meanwhile thanks for this video. I learnt alot.