Build a REST API in Go using Fiber + GORM

Sdílet
Vložit
  • čas přidán 20. 06. 2024
  • In this video we're going to build a REST API in Go using the web framework Fiber and the Go ORM library GORM alongside a SQL database
    👨‍💻 Looking for a web developer job, visit: www.webdevjobs.io/
    👽 Discord - / discord
    ⏳ Timestamps
    00:00:00 - Project Setup
    00:09:00 - Database
    00:13:00 - Creating our models
    00:22:14 - User routes
    00:51:12 - Product routes
    01:06:53 - Order routes
    The finished code can be found here:
    👾 - github.com/sixfwa/fiber-gorm
    #Go #Fiber

Komentáře • 85

  • @iamrithmic
    @iamrithmic  Před 4 měsíci +1

    👽 Join the Discord Server (link in the description)

  • @rohankhatua2102
    @rohankhatua2102 Před 10 měsíci +7

    this video is gold, i needed to learn go for a project within a week and this covered largest chunk of it in under 2 hours

  • @iliatalebzade8751
    @iliatalebzade8751 Před 2 lety +16

    The fact that you're repeating the crud functionality with different parts of this project is so awesome because after the second or third time people can see the pattern and have a higher chance of not just memorizing but learning how to implant a CRUD operation into a service, and don't let me start on how great the explanations were. great job with the tut and please do keep up with the good work!

    • @iamrithmic
      @iamrithmic  Před 2 lety +2

      Thank you so much for this comment. I’m really glad that this tutorial came across that way. This comment has made my day!
      More to come

  • @truthseeker2171
    @truthseeker2171 Před 2 lety +18

    Coming from a Laravel and node background, this was just so simple to understand and follow. Thank you.

    • @iamrithmic
      @iamrithmic  Před 2 lety +1

      Thanks for the comment! So glad this helped

  • @delisky842
    @delisky842 Před 5 měsíci +3

    You are saving lives, this is an amazing follow along tutorial

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

      Glad it was helpful & thank you for the comment!

  • @hamaed19
    @hamaed19 Před 11 měsíci +4

    nice content, keep it up!

  • @devjeff3192
    @devjeff3192 Před 2 lety +6

    Have been using Django and Flask since I got into backend development and you made it pretty simple and easy to understand. Thank you soo much.

    • @iamrithmic
      @iamrithmic  Před 2 lety +1

      Im really glad that this is the case, thank you!

  • @Anl-ly6tx
    @Anl-ly6tx Před 3 měsíci +2

    Amazing tutorial! Thanks a lot.

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

      Thanks for the awesome comment! Glad it was helpful

  • @matkomilic8382
    @matkomilic8382 Před 8 měsíci +2

    Thank you, very useful tutorial, I've learned a lot as I needed this since my company wants me to start doing backend with GO. I created all this code along with you with my own modifications. Great stuff.

  • @anuj7286
    @anuj7286 Před 11 měsíci +2

    Great learning experience with this channel. Thank you and please create more videos.

  • @MrKeliv
    @MrKeliv Před rokem +1

    I came from Laravel and Rails. and I just learn Go and I found your tutorial. Its very helpfull for beginner like me.
    This is very simple example. Thanks

  • @bndrmrtn1859
    @bndrmrtn1859 Před 8 měsíci +1

    thanks, now i understand the basics how fiber and gorm works 😁

  • @georgegiosue
    @georgegiosue Před rokem +1

    thank you very much friend, very good explanation :)

  • @sarvarjuraev1376
    @sarvarjuraev1376 Před rokem +1

    Awesome. Now I got the big picture of API as a full

    • @iamrithmic
      @iamrithmic  Před rokem

      Thanks for the comment! I’m glad this was useful

  • @telostia
    @telostia Před rokem +6

    nice tutorial! great presentation 🙂 you should do more GO tutorials

    • @iamrithmic
      @iamrithmic  Před rokem +1

      Thank you! Yes I have more planned :)

  • @LearnProgramsCJ
    @LearnProgramsCJ Před rokem +1

    Nice tutorial and ecpected more on user login authentication(JWT) like so..❤

  • @elcanaldeflopimotta785
    @elcanaldeflopimotta785 Před 2 lety +1

    thanks a lot for this video, for my that i am beginner is very import and a lot util this clase of video
    again thanks!

  • @toothless.tarantula
    @toothless.tarantula Před 10 měsíci +1

    Great Video.

  • @cristhiamtovar9003
    @cristhiamtovar9003 Před 2 lety +4

    Thank you so much for sharing. I liked your Golang crash course, the repository was cozy because the commits matched with the timestamps. Can you upload this repo in the same way?

    • @iamrithmic
      @iamrithmic  Před 2 lety +1

      thanks for the awesome comment :). Yes i will look into re uploading the code so it's more inline with each section. Thanks for the hint, will also keep this in mind for future content

  • @zeinabyari
    @zeinabyari Před rokem +2

    very usefull👍

  • @thientran2978
    @thientran2978 Před 2 lety

    thank you

    • @iamrithmic
      @iamrithmic  Před 2 lety

      You're welcome 😊. Glad you enjoyed

  • @abdulhamidkhorajiya2256
    @abdulhamidkhorajiya2256 Před 2 lety +1

    Great

  • @prashlovessamosa
    @prashlovessamosa Před rokem +1

    Thank you

  • @ibanguniverse811
    @ibanguniverse811 Před rokem

    Nice tutorial, how do you align your code vertically ?

  • @gam3rboy_official
    @gam3rboy_official Před rokem +1

    This is great.
    Btw vs code theme ?

  • @tryoasnafi4340
    @tryoasnafi4340 Před rokem +1

    Nice video, clear explaination. I think we should call that controllers instead of routes.

    • @iamrithmic
      @iamrithmic  Před rokem

      Yes that is also a very valid name!

  • @dimakovalenkov7835
    @dimakovalenkov7835 Před rokem

    спасибо = )

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

    what do you use to auto indent the data types of your model fields

  • @WW-qv8uw
    @WW-qv8uw Před 2 lety

    Great content. Could you plz add pagination function~

  • @abdulhamidkhorajiya2256
    @abdulhamidkhorajiya2256 Před 2 lety +1

    Please add more videos on golang with gin framework

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

    Thank you very much. Your content was helpful. Better if you could use proper HTTP response codes as well.

  • @daniel_2
    @daniel_2 Před rokem +2

    Why do you use sometimes "int" and sometimes "uint"?
    Isn't that (id) the same field and should also use the same data type?
    Btw. good video!

    • @expectations2188
      @expectations2188 Před rokem +1

      "int" accepts both negative and positive numbers where "uint" accepts only positive numbers.

  • @MuhammadUzair-vw4hw
    @MuhammadUzair-vw4hw Před 2 lety +1

    The video duration is more than one hour, but I took more than one day to learn and finish your video. Thank you for sharing, and keep it up!

    • @iamrithmic
      @iamrithmic  Před 2 lety +1

      Im glad it was of use to you :). Thank you for the comment

  • @sujaydas5024
    @sujaydas5024 Před rokem

    what if I want to order multiple products at one go ?

  • @hos7012
    @hos7012 Před rokem +2

    may i ask about the name of your vsc theme?

  • @nazargavrilov873
    @nazargavrilov873 Před 9 měsíci +1

    Great video!
    VS Code Theme bro, pls :)

  • @LearnProgramsCJ
    @LearnProgramsCJ Před rokem +1

    Hey, I am working on updateOrder function I have an issue in update User value for
    example
    var user model.User
    database.DB.Find(&user, "id=?", order.UserRefer)
    order.User = user(I am getting a issue here) like json: cannot unmarshal number into Go struct field

    • @LearnProgramsCJ
      @LearnProgramsCJ Před rokem +1

      Hey sorry this is fixed

    • @LearnProgramsCJ
      @LearnProgramsCJ Před rokem

      I am tring to update order like this
      order.User = user
      order.Product = product
      database.DB.Save(&order)
      Its not working let me know any input from you

    • @iamrithmic
      @iamrithmic  Před rokem

      @@LearnProgramsCJ nice one 🔥

  • @blacktipe9922
    @blacktipe9922 Před 2 lety +3

    Are you from germany?

    • @iamrithmic
      @iamrithmic  Před 2 lety +1

      I'm not from there, but i do live in Germany :)

    • @blacktipe9922
      @blacktipe9922 Před 2 lety

      @@iamrithmic oh nice! Could you do React Typescript Authentication with a database? Its really asked and nobody has a good video about it

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

    Every time you mention "gorm", I think of "blue", as in Irish "gorm" [said a gur-um] means "blue". Also, speaking of blue in Irish, "fear/bean gorm" [far/ban gur-um] literally translates to "blue man/woman", but it means a black man/woman, as to call a person "black" or "dubh" [dove] means they are bad/evil.

  • @harloom9603
    @harloom9603 Před 2 lety +3

    how about testing API?

    • @iamrithmic
      @iamrithmic  Před 2 lety +2

      Good idea, will think on that one

  • @hirakhax
    @hirakhax Před rokem +2

    Theme name please?

  • @johnsonkengne6229
    @johnsonkengne6229 Před rokem +1

    please what is your thème name?

  • @abdulhamidkhorajiya2256

    Authentication please

  • @user-lg3zg8oi5d
    @user-lg3zg8oi5d Před rokem

    37:44 memo 22.9.13

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

    I gave up after 21 minutes. Only because some of the commands are for Linux (e.g. "APP_ENV=dev"). I desperately tried to get it to work in Windows, but it is slow to run (I think it's gcc)

  • @user-yv5ri7tx9k
    @user-yv5ri7tx9k Před 5 měsíci +2

    Great Video, but be careful DO NOT this in production. This called an N+1 query, where for each order, he's searching the product and the user db for the user and the product. This is not a very good practice. Instead try to use something like eager loading or table joins. But for an educational purpose, good material.

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

      This is an important point. Yes in the context of this video it had to be overlooked. But in a professional setting, you're 100% correct

  •  Před 2 lety +1

    Hi, congrat about the content.
    I try to follow your tutorial, but i have a problem in app.Post("/api/users", routes.CreateUser)
    Message is:
    cannot use routes.CreateUser (value of type func(c *fiber.Ctx) error) as func(*fiber.Ctx) error value in argument to app.PostcompilerIncompatibleAssign
    I tried in my windows 10, and i thought that was some incompatible with windows, I tried in my ubuntu and had the same problem.
    I searched in web, but nothing else help me.
    How solve it?
    the code is exactly the same as yours.
    My go version is 1.17.5.
    Thanks
    Toti

  • @ivandjoh7522
    @ivandjoh7522 Před 2 lety

    Awesome tutorial, it easy to follow the step,
    by the way, what theme of vs code did you use? @rithmic

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

    with air i get : "Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub"
    and with run main.go it says :" C compiler i.e. gcc is not in path

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

      After countless tries i could not fix it, so i decided to use a different cgo free driver, which is although a bit slower but gets the job done