The TRUTH About Golang Backend Frameworks

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
if you are coding in go you have probably asked yourself what go framework should I use now I want to be specific and focus on Frameworks that people would typically use when they're building a go backend for their API and not so much Frameworks they would use for creating something like acli which if you haven't heard already Cobra and charm are great options so go use them it doesn't take a whole lot of effort to do one quick Google search on what go framework to use to see a whole bunch of lists pop up and then you get yourself into what I like to call the JavaScript problem the JavaScript problem is when there's too many options of what tool Library framework to use without actually knowing which one you truly need and want for your applications in JavaScript is react view svelte solid Astro next I mean it's JavaScript the ecosystem is evolving and changing every single day but in go I mean there's also a lot of options there's gin there's Qi there's fiber there's Echo there's Vulpix that's a Pokemon I try to trick you the very best which framework is right for them well that's the actual thing there is no right framework in go so you can see here I'm on go Chi and if I just read the first bit of the readme QI is a lightweight idiomatic and composable router for building go HTTP Services if I flip to go Jin Jin is a web framework writ and go it features a martini lick API with performance that is up to 40 times faster thanks to http router if you check out go fiber fiber is an Express inspired web framework built on top of fast HTTP the fastest HTTP engine for go and if we check go Echo we can do some of the featured overviews optimized HP router with smartly prioritized routes build robust and scalable restful apis have you noticed a pattern you see a lot of these libraries in go these Frameworks are essentially doing the same thing they are just rappers on top of the standard library that go offers and this isn't necessary that's a sad thing and I'm not saying all of these are the exact same but when you are focusing on just creating routes or middleware or anything like that you can pick any of them here we're back on go Chi and you can see this example as easy as you have your import so there's Qi there's a standard HTTP library and they're in your function main you create your new router using Chi Library you create the middleware and you're designing a route here this get route with a response that just says welcome looks super simple wow Qi is great all right let's flip on to Jen for a second gin you have your import net HTTP and Jin okay awesome so you create gin dot default and oh oh you define your route that has a response okay cool this is great this is awesome how about we check out fiber for a second you have your import fiber and oh oh app fiber.new and you define this looks almost exactly the same you have to get route that just says hello world okay well how about we check out Echo for real quickly just you know just to check out how different can it be and oh you create your new Echo instance okay middleware or all right and you you get route with a response that says hello world you can see that all of them followed the same pattern and yes Jin and Chi may have things that provide more use case in a fully fleshed out library and framework to use but at the end of the day you create the instant you define your get or post route and you pass it a function or literally a Json payload and it just does what you tell it to the Handler respond to the route how you define it and it looks the exact same way for every single one and just to Showcase another example one that I personally recommend is HTTP router by Julian Schmidt because this is the closest to the standard library that you can get between all the examples I previously showed you can see here Define two handlers index and hello you define your routes by instantiating HTTP router from the library you pull in and then you have a two dot get map method on these two routes declared and they will pass the function of the Handler and so what I really want to kind of convey and what I always talk about when I explain go to someone is that you have to separate your thinking of go from JavaScript if you're coming from that world or any other world because go you can truly do everything with the standard Library go isn't that program language where you should be picky and really pulling resources or deciding which framework is right for you of course you can use particular use cases that you can read about and really discover that huh this really solved the problem I have I'm going to use and that's pretty perfectly fine but if you're spending time spinning your wheels on deciding from all the frames that you see from a best framework to use in 2023 list you're wasting your time what I recommend to everyone who's starting with go is essentially try to do things using just the standard Library don't start importing modules or Frameworks if you don't need them they're all the same but why am I recommending HTTP router milk didn't you just say try to make it yourself and that's a valid point but like I said earlier HTTP router is the closest one to the standard library and that is why I personally like it you don't need to bring anything new it's simply just a router that gives you everything you need to fully pass in any Handler you decide to create and there's other libraries and Frameworks they can use in the go ecosystem richest people always developing new things to use if you want to use something for sending emails or specifically handling you know crypto hashes or jaw tokens or anything like that there's something that there for you but use a standard Library explore the standard Library first you'll be surprised on how well and defined those things come stock in the go ecosystem so with that guys I gotta leave you with two things out of all of the Frameworks I just decided and listed which one have you used for your go application and if you if you used one I challenge you to use the standard Library remove that framework from your app and just try replicating it with the standard library and let me know if you're successful or not and two you gotta power it
Info
Channel: Melkey
Views: 105,147
Rating: undefined out of 5
Keywords: video sharing, video, sharing, computer science, software engineer, silicon valley, computer programming, coding, learn to code, machine learning, artificial intelligence, cloud, python, javascript, how to code, Data scientist, AI developer, Machine Learning, golang, go programming language, go frameworks, go chi, go fiber, go echo, gorilla mux, lets go
Id: JECZTdEJnOI
Channel Id: undefined
Length: 6min 30sec (390 seconds)
Published: Tue Sep 05 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.