Creating a JSON CRUD API in Go (Gin/GORM)

Sdílet
Vložit
  • čas přidán 8. 07. 2022
  • In this video we'll create a basic JSON CRUD API in Go lang using the popular framework Gin and the top ORM GORM. This is a great beginner tutorial if you're just starting out with Go and will introduce you to some popular libraries.
    Make sure to like and subscribe!
  • Věda a technologie

Komentáře • 130

  • @japanboy31415
    @japanboy31415 Před rokem +31

    the reason that i like this tutorial the most is because he actually shows where the code is coming from within the documentation. these other ones, i feel like theyre just pulling it out of their asses and it is so confusing. thank you so much !

  • @kannankalidasan
    @kannankalidasan Před rokem +4

    Just 1 video watched . become a channel member, subscribed, pressed bell button 😃 , Got a real confidence in building my first go project by going through this.👏👏👏

  • @therealchiko
    @therealchiko Před rokem +7

    Awesome tutorial, concise and straight to the point!

  • @md.mahadyhasan8456
    @md.mahadyhasan8456 Před rokem +32

    Awesome!! No bullshit, straight to the point. You teach in 10 mins what others teach in 30-40 mins. Great job!

  • @nnguyetnam
    @nnguyetnam Před rokem

    Great thanks!!!! You have opened my mind on how golang server can be built up in such a few concise steps.

  • @eoinholland5647
    @eoinholland5647 Před rokem +3

    The most concise and clear tutorial on this topic! Thank You, I'm subbed now :D

  • @darumaleo
    @darumaleo Před 3 měsíci

    damn man, i love this kind of videos! very concise, no wasting time, going straight to the point! very helpful

  • @htetlinlinnaing4994
    @htetlinlinnaing4994 Před rokem +1

    This is the amazing video I have ever seen! Thank you and hope to upload more video about Golang.

  • @Laflamablanca969
    @Laflamablanca969 Před rokem +22

    Bro… great tutorial. Clear, concise and no BS 🎉 I’ve just subbed 👏

  • @ivancazzamali4508
    @ivancazzamali4508 Před rokem +4

    supernice! I really like that you keep the loop "say what you'll implement" --> "code" --> "check result" very short. it makes it very easy to follow and see what does what. immediately subscribed

  • @sondernfy
    @sondernfy Před rokem

    Awesome! I'm just starting out, and this is pointing me the right way

  • @embrace7972
    @embrace7972 Před 8 měsíci

    Amazing stuff man, really appreciate the content. I am new to golang, and the way you used the docs, I have learnt a lot.

  • @alfbaez
    @alfbaez Před rokem

    Brilliant! simply put Brilliant! Thanks for knowledge sharing!

  • @JoseBarahonajrab66
    @JoseBarahonajrab66 Před 7 měsíci

    Just starting on go , this tutorial was amazing 🤙🏻

  • @christopherrobin5796
    @christopherrobin5796 Před 3 měsíci +1

    beautiful tutorial, decent explanation, 10/10

  • @yishstudio8393
    @yishstudio8393 Před rokem

    it's really helpful for me to understanding CURD with go and packages.

  • @JDUDEadventure
    @JDUDEadventure Před měsícem

    Thank you so much for posting this video. It really helped in teaching GO.

  • @mounis
    @mounis Před rokem

    Amazing video, thanks for sharing!

  • @alfathmuqoddas6986
    @alfathmuqoddas6986 Před rokem

    Thank you very much! very concise and easy to follow

  • @JhonatanMorais
    @JhonatanMorais Před rokem

    Fantastic! you did great! thank you so much for share it!

  • @XORknight
    @XORknight Před 9 měsíci

    Best Golang API tutorial

  • @zahreddinesoualem3213

    Very clear, neat tuto, thanks.

  • @Surya001x
    @Surya001x Před 2 měsíci

    Best video, I was looking for this perfect videos. Thanks alot

  • @3damina911
    @3damina911 Před rokem

    Thanks! really easy and simple methods to CRUD in Go..

  • @omartahboub2900
    @omartahboub2900 Před 9 měsíci

    Great Tutorial ! String to the point !

  • @simonjanca
    @simonjanca Před rokem

    That's a great video I was looking around. Thanks :)

  • @youtobe00009
    @youtobe00009 Před rokem

    Nice and straight tutorial. thank you

  • @acronproject
    @acronproject Před 4 měsíci

    Thanks so much Mr.Robby. That very useful for me

  • @yoskokleng3658
    @yoskokleng3658 Před 2 měsíci

    i am from laravel dev. this structure is similar to laravel. Great Video. i will follow this. Thank you

  • @feynmaz
    @feynmaz Před rokem

    Thank You for such a great tutorial

  • @morkhoudia9
    @morkhoudia9 Před rokem

    With these tutorials on go, i have skills on. Thanks you Robby.

    • @belski256
      @belski256 Před rokem

      Where are You..I am in the +256

    • @morkhoudia9
      @morkhoudia9 Před 11 měsíci

      I am from Senegal, Africa

  • @matinrazaghi3218
    @matinrazaghi3218 Před rokem

    Thank you for the great toturial

  • @HenkeB515
    @HenkeB515 Před 3 měsíci

    Great tutorial, thank you!

  • @yaodenis2682
    @yaodenis2682 Před rokem

    Great Tutorial !!!👏

  • @guccigreatness4925
    @guccigreatness4925 Před 3 měsíci

    Awesome tutorial & thank you bro 😊

  • @ahmadfadhlirachmat5673
    @ahmadfadhlirachmat5673 Před 5 měsíci

    Very compact tutorial, straight to the solution. Subs +1

  • @narcissisticnarcissus4956
    @narcissisticnarcissus4956 Před 2 měsíci +1

    Amazing!

  • @ianvieira283
    @ianvieira283 Před rokem

    That was great!

  • @vitojulianochannel
    @vitojulianochannel Před rokem

    Thanks for the tutorial 👑 If you make the unit test for this, it will be more perfect 😁

  • @iqro199
    @iqro199 Před měsícem

    you are the best teacher bro)

  • @NikhilKumar-sv2kb
    @NikhilKumar-sv2kb Před měsícem

    Thank you very much!!! very helpful

  • @bronxed3666
    @bronxed3666 Před rokem +1

    Fantastic Video. thank you, subbed

  • @libertad83y
    @libertad83y Před rokem +6

    Jeez! You deserve 100x more subscribers, great teaching! 🥳 One question: "what is the advantage of tableplus compared to the integrated browser of ElephantSQL?"

  • @japanboy31415
    @japanboy31415 Před rokem +1

    out of all the crud videos on golang that i have watched, this is the best one. Is this an accurate representation of how to actually create a golang, or are we not getting introduced something ? i watched akhils tutorial and it was so complicated that i was so lost, but this one seems to do all of the CRUD endpoints and was wondering if I can use this as a reference ?

  • @nadeemshareef7508
    @nadeemshareef7508 Před 2 měsíci

    Awesome Brother!

  • @nicholasmaundu2130
    @nicholasmaundu2130 Před rokem

    new subscriber, awesome content and document reference on point.

  • @johnxisde
    @johnxisde Před rokem +1

    Thanks for this tutorial, Robby! any idea about how effective delete data from db instead update that flag, deleted at?

  • @falxcodeinc2072
    @falxcodeinc2072 Před rokem

    Good stuff !!!

  • @jokerboozp
    @jokerboozp Před rokem

    Just awesome!!!!!!!Thank u!!!

  • @alessandroscimone5463
    @alessandroscimone5463 Před rokem +1

    Good video! Thanks

  • @wisdomelue
    @wisdomelue Před 7 měsíci

    loved it, thanks

  • @csnawwa
    @csnawwa Před 5 měsíci

    thanks Robby you are awesome

  • @peterdaayeng7155
    @peterdaayeng7155 Před 6 měsíci

    Great , Just suscribed

  • @mrginn
    @mrginn Před 4 měsíci

    thanks for the tutorial.

  • @galangsatria7210
    @galangsatria7210 Před rokem

    Nice Tutorials

  • @moeenkamali1288
    @moeenkamali1288 Před rokem

    nice work

  • @abhishekrajput4656
    @abhishekrajput4656 Před 11 měsíci

    Thanks this helped me alot

  • @Ennem0_o
    @Ennem0_o Před 4 měsíci

    Thanks for the video.
    How would you add automatic Swagger/OpenAPI doc generation on this project ?

  • @manee427
    @manee427 Před rokem

    Perfect

  • @morkhoudia9
    @morkhoudia9 Před rokem +1

    Good & marvellous. Is it githubable ?

  • @SMELLNES
    @SMELLNES Před rokem

    clean

  • @nerochaniago81
    @nerochaniago81 Před rokem

    cool!

  • @InstallSkill
    @InstallSkill Před 3 měsíci

    Too good

  • @caleyCodeLab
    @caleyCodeLab Před měsícem

    Do you need to install CompileDaemon globally to use it? I'd like to manage it in a similar way to npm scripts

  • @SaurabhSharmaIndia
    @SaurabhSharmaIndia Před rokem

    Nice tutorial!!
    Can we return the response in camel case including created at and updated at?

    • @codingwithrobby
      @codingwithrobby  Před rokem +1

      Yes you can, try replacing the gorm.Model line with:
      ID uint `gorm:"primary_key" json:"id"`
      CreatedAt time.Time `json:"createdAt"`
      UpdatedAt time.Time `json:"updatedAt"`
      DeletedAt *time.Time `json:"deletedAt"`

  • @DioArsya
    @DioArsya Před rokem

    Nicee

  • @UnboxLabOfficial
    @UnboxLabOfficial Před 9 měsíci

    Nice

  • @lemmyz1
    @lemmyz1 Před rokem

    Any suggestions to replicate this using mongo db?

  • @japanboy31415
    @japanboy31415 Před rokem

    @14:39 why do we need to do func init(){} when we are importing initializers and models at the top with import()

  • @wisdomelue
    @wisdomelue Před 7 měsíci

    any reason why we had to do go get and go install for compile daemon

  • @shubhamrane9389
    @shubhamrane9389 Před 8 hodinami

    I am having issue after running migrate file. initializers.DB is coming out as nil. But in ConnectToDB I can establish connection DB. Is there some other platform to address issues like this?

  • @shehapeldien7025
    @shehapeldien7025 Před 7 měsíci

    every thing works in first try

  • @ajith_e
    @ajith_e Před 7 měsíci

    Thank you!
    btw. you sound like Rami Malek

  • @MaheshKumar-bg5re
    @MaheshKumar-bg5re Před rokem

    why cant we use the env variables in costants?

  • @dharamraj6646
    @dharamraj6646 Před rokem

    @coding with roby where can i get this code ..?

  • @moeenkamali1288
    @moeenkamali1288 Před rokem

    it would be great if share source on github or somewhere else

  • @red_boum
    @red_boum Před 10 měsíci

    Is there a Github for the final code?

  • @cub379
    @cub379 Před rokem +1

    What version of go are you running here?
    I can't get the CompileDaemon to work.
    edit: If anybody else encounters with the same issue, fix on my end was that i forgot to add the gon/bin/ folder to my PATH

    • @codingwithrobby
      @codingwithrobby  Před rokem +1

      I'm running 1.18.3. Here's an alternative I've used if you can't get it going: github.com/codegangsta/gin

    • @libertad83y
      @libertad83y Před rokem

      same issue with CompileDaemon, I just copied it in my project folder

    • @cub379
      @cub379 Před rokem

      @@libertad83y i am pretty sure you have to place compile deamon in golang install folder and then bin, i can check when i come home from work remind mi if i forget hah

    • @TudorCizmas
      @TudorCizmas Před rokem

      Did you update your $PATH?

    • @cub379
      @cub379 Před rokem

      @@TudorCizmas yea, I have /home/leon/go/bin in my path

  • @shaheer1948
    @shaheer1948 Před rokem

    Hello, Did you post the code anywhere!! Please !! I need the Code which you've Executed.

  • @snoopy8870
    @snoopy8870 Před 5 měsíci

    whats the music at the beginning?

  • @luthfiarsyad358
    @luthfiarsyad358 Před rokem +1

    Hello Robby, it was a great tutorial step by step but i encounter an error when go run migrate/migrate.go saying invalid memory address or nil pointer dereference.. please help on telling me what to do :( thank you!

    • @codingwithrobby
      @codingwithrobby  Před rokem +1

      Hey there, sounds like the models didn't import correctly or you made a typo somewhere. I'd go through and double check everything matches mine in the video.

    • @luthfiarsyad358
      @luthfiarsyad358 Před rokem +1

      @@codingwithrobby LOL IT IS, i was writing a typo, i shouldve not declarating var on migrate, i should use = instead of := 😁😁 my mistake man, thank youu for helping 🤣🤣

    • @emirhansoylu
      @emirhansoylu Před rokem

      I've got same error too. Idk why it throw error but i solve it by adding the assignment.
      var DB *gorm.DB
      func ConnectToDB() {
      ...
      db, err := gorm.Open(postgres.Open(dsn), &gorm.Config{})
      DB = db
      ...
      }

  • @MrAmG17
    @MrAmG17 Před rokem

    What about error handling?

  • @drefaux6669
    @drefaux6669 Před rokem

    great tutorial but you should also catch errors in this vid too

  • @nandhawalrost
    @nandhawalrost Před 4 měsíci

    thank you, good karma

  • @FoXSnoW1
    @FoXSnoW1 Před rokem +3

    where is repo.

  • @tgraupne
    @tgraupne Před rokem

    Hi @Coding with Robby , great video, than you very much. Do you have a Github profile or any other way you could share your code?

    • @codingwithrobby
      @codingwithrobby  Před rokem +1

      Thanks for watching! To be honest I didn't save any of the code from this video. In future videos I'll try to provide GitHub links.

  • @simonjanca
    @simonjanca Před rokem

    What's the request making tool you use to test the API?

  • @faizulla5838
    @faizulla5838 Před 8 měsíci

    How do it without Gorm ?

  • @user-ro9ty1qk6r
    @user-ro9ty1qk6r Před 2 měsíci

    getting the error "command not found: CompileDaemon" even after installing the CompileDaemon using go get command in the project folder.

    • @codingwithrobby
      @codingwithrobby  Před 2 měsíci

      You have to add your go bin folder to path then run go install not go get on the package

  • @leodegrinchi6878
    @leodegrinchi6878 Před 9 měsíci

    17:22 создали))) 😄

  • @MaheshKumar-bg5re
    @MaheshKumar-bg5re Před rokem

    is postgresql better than mysql?

    • @codingwithrobby
      @codingwithrobby  Před rokem

      I think it’s mostly personal preference. I just started using Postgres because Heroku supports it.

  • @thefulltutorial4278
    @thefulltutorial4278 Před 9 měsíci

    Why you used package main here instead of package migrate 14:02

  • @jewlouds
    @jewlouds Před 5 měsíci +1

    Is that Wubuntu?

  • @tnnz9920
    @tnnz9920 Před rokem

    can i do without daemon compiler?

    • @codingwithrobby
      @codingwithrobby  Před rokem

      Yes, you’ll just have to manually restart when you make changes.

  • @chrishabgood8900
    @chrishabgood8900 Před rokem +1

    hmm, initializers/Postgres.go:16:2: DB declared but not used

    • @codingwithrobby
      @codingwithrobby  Před rokem +5

      DB should be used within the ConnectToDatabase function. Double check your code matches mine. You probably have := instead of just = . Hope this helps!

    • @muhammadfauzanalghifari7776
      @muhammadfauzanalghifari7776 Před rokem

      @@codingwithrobby I have the same problem and this solved my problem, thank u!! i am new to golang did not notice this at the first place, btw this vid really helps! thank u once again

  • @it1860
    @it1860 Před rokem

    em
    where github / gitlab url of code ?

  • @MrCleverOnion
    @MrCleverOnion Před 4 měsíci

    My only complaint is that there's no links. It's so much easier to just read the code

  • @ThePirateHistory
    @ThePirateHistory Před 3 měsíci

    That's kinda GoRuby, but not go...

  • @dhanushg5254
    @dhanushg5254 Před měsícem

    Excellent Video but your naming scheme sucks

  • @it1860
    @it1860 Před rokem +1

    Can you provide GitHub link for this project?