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

Поділитися
Вставка
  • Опубліковано 17 січ 2025

КОМЕНТАРІ • 151

  • @japanboy31415
    @japanboy31415 Рік тому +50

    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 !

    • @inspirehub-rich
      @inspirehub-rich Рік тому +2

      you are 100% correct

    • @MrCleverOnion
      @MrCleverOnion 4 місяці тому

      But there is no GitHub repo available to look at like all the other ones

  • @md.mahadyhasan8456
    @md.mahadyhasan8456 Рік тому +39

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

  • @KannanKalidasan
    @KannanKalidasan Рік тому +6

    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.👏👏👏

  • @Laflamablanca969
    @Laflamablanca969 2 роки тому +25

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

  • @filiperodrigues6969
    @filiperodrigues6969 6 місяців тому

    I would like to like this video way way way more times than just one, this is amazing, great job, the quality is off the charts

  • @darumaleo
    @darumaleo 10 місяців тому

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

  • @ivancazzamali4508
    @ivancazzamali4508 2 роки тому +5

    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

  • @therealchiko
    @therealchiko 2 роки тому +7

    Awesome tutorial, concise and straight to the point!

  • @eoinholland5647
    @eoinholland5647 2 роки тому +3

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

  • @christopherrobin5796
    @christopherrobin5796 10 місяців тому +1

    beautiful tutorial, decent explanation, 10/10

  • @htetlinlinnaing4994
    @htetlinlinnaing4994 2 роки тому +1

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

  • @AbhinavNair-x8t
    @AbhinavNair-x8t 4 місяці тому

    Super awesome. No bs video. Highly recommended

  • @yoskokleng3658
    @yoskokleng3658 9 місяців тому +1

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

  • @geoffreyhoffman2739
    @geoffreyhoffman2739 4 місяці тому

    As other commenters have said - I thought this was great. I feel like Gorm shouldn’t fetch a deleted model and the route should return 401 in that case. Just my $0.02. But that is more about Gorm. Nice work Robby! Another subscriber.

  • @nnguyetnam
    @nnguyetnam 2 роки тому

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

  • @ShriReddy007
    @ShriReddy007 Місяць тому

    great one, had a crazy ride

  • @JDUDEadventure
    @JDUDEadventure 8 місяців тому

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

  • @XORknight
    @XORknight Рік тому

    Best Golang API tutorial

  • @embrace7972
    @embrace7972 Рік тому

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

  • @carshoesch
    @carshoesch 2 місяці тому

    Nice video! Helped me learning the basics of gorm. But I would've returned with a internal error if the id is not within the db.

  • @alfbaez
    @alfbaez Рік тому

    Brilliant! simply put Brilliant! Thanks for knowledge sharing!

  • @JoseBarahonajrab66
    @JoseBarahonajrab66 Рік тому

    Just starting on go , this tutorial was amazing 🤙🏻

  • @raunakagarwal6077
    @raunakagarwal6077 3 місяці тому

    Very good explanation for beginners like me

  • @morkhoudia9
    @morkhoudia9 2 роки тому

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

    • @belski256
      @belski256 2 роки тому

      Where are You..I am in the +256

    • @morkhoudia9
      @morkhoudia9 Рік тому

      I am from Senegal, Africa

  • @sondernfy
    @sondernfy Рік тому

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

  • @Surya001x
    @Surya001x 9 місяців тому

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

  • @dowletodeberdiyew7412
    @dowletodeberdiyew7412 4 місяці тому

    it seems like this guy is learning with us

  • @Yagnik_Sojitra
    @Yagnik_Sojitra 28 днів тому

    Great video, how to do error handling ?

  • @libertad83y
    @libertad83y 2 роки тому +6

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

    • @brandonjapol9853
      @brandonjapol9853 Рік тому

      and then he opens postman not three minutes later lol

  • @johnxisde
    @johnxisde 2 роки тому +1

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

  • @iqro199
    @iqro199 8 місяців тому

    you are the best teacher bro)

  • @japanboy31415
    @japanboy31415 Рік тому

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

  • @omartahboub2900
    @omartahboub2900 Рік тому

    Great Tutorial ! String to the point !

  • @Ennem0_o
    @Ennem0_o 11 місяців тому

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

  • @shubhamrane9389
    @shubhamrane9389 7 місяців тому +1

    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?

    • @xjdn-34-gdndnk-45-aa
      @xjdn-34-gdndnk-45-aa 5 місяців тому

      the same for me on 1.22. There is an issue with having DB globally. So golang complains about having DB variable assigned to value but used inside connection func. Now Im trying to return DB var from this functions so I could catch it and define any time I need DB from initializers. Looks like shit, if to be honest

    • @xjdn-34-gdndnk-45-aa
      @xjdn-34-gdndnk-45-aa 5 місяців тому

      uh, I have fixed my problem. It seems like it is `DB, err :=` instead of `DB, err =`. So in my case it was a problem of a dynamic type defintion

  • @simonjanca
    @simonjanca Рік тому

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

  • @acronproject
    @acronproject 11 місяців тому

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

  • @madeOfClay99
    @madeOfClay99 4 місяці тому

    Thank you for the video. Although it would've been great to see if you handle dependency injection and the usage of a proper service layer to handle the DB logic.
    Additionally, I am not sure if moving the db creation and some other stuff into an env variable is a good practice.
    I understand this was a beginner tutorial, so thanks again.

  • @ahmadfadhlirachmat5673
    @ahmadfadhlirachmat5673 Рік тому

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

  • @7509whynotresist
    @7509whynotresist 2 місяці тому

    beautifully explained with no bs

  • @japanboy31415
    @japanboy31415 Рік тому +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 ?

  • @JhonatanMorais
    @JhonatanMorais Рік тому

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

  • @alfathmuqoddas6986
    @alfathmuqoddas6986 Рік тому

    Thank you very much! very concise and easy to follow

  • @yishstudio8393
    @yishstudio8393 Рік тому

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

  • @bronxed3666
    @bronxed3666 2 роки тому +1

    Fantastic Video. thank you, subbed

  • @guccigreatness4925
    @guccigreatness4925 10 місяців тому

    Awesome tutorial & thank you bro 😊

  • @nicholasmaundu2130
    @nicholasmaundu2130 Рік тому

    new subscriber, awesome content and document reference on point.

  • @jewlouds
    @jewlouds Рік тому +1

    Is that Wubuntu?

  • @muhmmadabubakarijaz1811
    @muhmmadabubakarijaz1811 3 місяці тому

    a very informative video

  • @HenkeB515
    @HenkeB515 10 місяців тому

    Great tutorial, thank you!

  • @mounis
    @mounis 2 роки тому

    Amazing video, thanks for sharing!

  • @SaurabhSharmaIndia
    @SaurabhSharmaIndia 2 роки тому

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

    • @codingwithrobby
      @codingwithrobby  2 роки тому +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"`

  • @tharaka911
    @tharaka911 Рік тому

    thanks Robby you are awesome

  • @thefulltutorial4278
    @thefulltutorial4278 Рік тому

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

  • @youtobe00009
    @youtobe00009 2 роки тому

    Nice and straight tutorial. thank you

  • @elegantapps3055
    @elegantapps3055 3 місяці тому

    thank you sir i learn a lot

  • @zahreddinesoualem3213
    @zahreddinesoualem3213 2 роки тому

    Very clear, neat tuto, thanks.

  • @matinrazaghi3218
    @matinrazaghi3218 2 роки тому

    Thank you for the great toturial

  • @feynmaz
    @feynmaz 2 роки тому

    Thank You for such a great tutorial

  • @caleyCodeLab
    @caleyCodeLab 8 місяців тому

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

  • @narcissisticnarcissus4956
    @narcissisticnarcissus4956 9 місяців тому +1

    Amazing!

  • @3damina911
    @3damina911 2 роки тому

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

  • @yaodenis2682
    @yaodenis2682 Рік тому

    Great Tutorial !!!👏

  • @NikhilKumar-sv2kb
    @NikhilKumar-sv2kb 8 місяців тому

    Thank you very much!!! very helpful

  • @galangsatria7210
    @galangsatria7210 2 роки тому

    Nice Tutorials

  • @alessandroscimone5463
    @alessandroscimone5463 2 роки тому +1

    Good video! Thanks

  • @morkhoudia9
    @morkhoudia9 2 роки тому +1

    Good & marvellous. Is it githubable ?

  • @asntechies8017
    @asntechies8017 6 місяців тому

    Bro why did you stopped making golang videos. Can you make one for bulk insert/crud api with gin/postgres with jwt auth. Thanks in advance and keep up the good work 👍

  • @moeenkamali1288
    @moeenkamali1288 2 роки тому

    nice work

  • @wisdomelue
    @wisdomelue Рік тому

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

  • @peterdaayeng7155
    @peterdaayeng7155 Рік тому

    Great , Just suscribed

  • @nadeemshareef7508
    @nadeemshareef7508 10 місяців тому

    Awesome Brother!

  • @mrginn
    @mrginn 11 місяців тому

    thanks for the tutorial.

  • @wisdomelue
    @wisdomelue Рік тому

    loved it, thanks

  • @FoXSnoW1
    @FoXSnoW1 2 роки тому +3

    where is repo.

  • @luthfiarsyad358
    @luthfiarsyad358 2 роки тому +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  2 роки тому +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 2 роки тому +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 Рік тому

      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
      ...
      }

  • @snoopy8870
    @snoopy8870 Рік тому

    whats the music at the beginning?

  • @chrishabgood8900
    @chrishabgood8900 2 роки тому +1

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

    • @codingwithrobby
      @codingwithrobby  2 роки тому +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 Рік тому

      @@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

  • @simonjanca
    @simonjanca Рік тому

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

  • @chotu-tv-12
    @chotu-tv-12 Рік тому

    Thanks this helped me alot

  • @shaheer1948
    @shaheer1948 Рік тому

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

  • @lemmyz1
    @lemmyz1 2 роки тому

    Any suggestions to replicate this using mongo db?

  • @red_boum
    @red_boum Рік тому

    Is there a Github for the final code?

  • @vitojulianochannel
    @vitojulianochannel 2 роки тому

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

  • @jokerboozp
    @jokerboozp Рік тому

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

  • @faizulla5838
    @faizulla5838 Рік тому

    How do it without Gorm ?

  • @falxcodeinc2072
    @falxcodeinc2072 2 роки тому

    Good stuff !!!

  • @cub379
    @cub379 2 роки тому +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  2 роки тому +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 2 роки тому

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

    • @cub379
      @cub379 2 роки тому

      @@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

    • @TdrMotoo
      @TdrMotoo 2 роки тому

      Did you update your $PATH?

    • @cub379
      @cub379 2 роки тому

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

  • @MaheshKumar-bg5re
    @MaheshKumar-bg5re 2 роки тому

    why cant we use the env variables in costants?

  • @AyushSisodia-m3i
    @AyushSisodia-m3i 9 місяців тому

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

    • @codingwithrobby
      @codingwithrobby  9 місяців тому +1

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

  • @dharamraj6646
    @dharamraj6646 2 роки тому

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

  • @moeenkamali1288
    @moeenkamali1288 2 роки тому

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

  • @ianvieira283
    @ianvieira283 Рік тому

    That was great!

  • @shehapeldien7025
    @shehapeldien7025 Рік тому

    every thing works in first try

  • @AbhinavNair-x8t
    @AbhinavNair-x8t 4 місяці тому

    can you share ur cheatsheet

  • @MrAmG17
    @MrAmG17 2 роки тому

    What about error handling?

  • @sumitmehra258
    @sumitmehra258 4 місяці тому

    As Elephantsql announces End of Life. Any alternative to that. Or can you update the video? Thanks @Coding with Robby

  • @InstallSkill
    @InstallSkill 10 місяців тому

    Too good

  • @UnboxLabOfficial
    @UnboxLabOfficial Рік тому

    Nice

  • @tgraupne
    @tgraupne 2 роки тому

    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  2 роки тому +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.