Gin is one of the most popular web application frameworks available for Go. It comes with a wide variety of options to customize the way that requests are handled and responses are generated. This course will introduce you to Gin and show you how to get started with it to build your own web applications.
Michael Van Sickle is an application architect in Akron, Ohio.
He is a mechanical engineer by training and a software engineer by choice.
He is passionate about learning new programming languages and user
Course Overview Hi everyone. My name is Michael Van Sickle and welcome to my course, Gin: A Web Application Framework for Go. I'm a software engineer at SitePen. There are many web frameworks springing up in the Go community, and it can be hard to decide which one to choose. In this course we'll go over the major features of Gin, so that you can decide if it's the right choice for your team. Some of the major topics that we'll cover include, how to configure routing, how to work with requests, including how to validate incoming data, how to formulate responses to requests, and how to work with middleware. By the end of this course you'll know how to get started with Gin. Before beginning the course you should be familiar with both the Go language, as well as how web applications work. I hope you'll join me on this journey to learn Gin with this course at Pluralsight.
Working with Requests Hello, and welcome back to this journey through the Gin web application framework. In the last module we talked about how to setup a routing scheme, and setup handlers to work with requests from clients. Now we're going to dig in to the request processing itself, and see what features Gin has to offer for us. We'll start out simply by learning how to work with single values. Those values can come into our application in basically three different forms. First, we'll see route parameters again, and review how to pull information from the URL itself into our handler. Then we'll move onto query parameters, and learn how to process them, and pull data out of them, and finally, we'll work with HTML form data that's coming into our application, and learn how to pull data from those forms one field at a time. Of course, working with a single field at a time isn't the most efficient way to work with many applications data, and so we'll move on to learning how to retrieve entire objects at one time, and finally, we'll talk about Gin's data validation framework, and we'll see how, despite what the documentation may imply, there's a very, very rich ecosystem here due to another library that Gin leverages. Okay, let's start talking about how to pull single values into our application.
Middleware Welcome back to this final module where we're talking about Gin, a web framework for Go. In the last few modules we've covered the primary path that HTTP requests are going to take through your application. We started by learning how to register our handlers, then we moved on to request processing, and in the last module we talked about the many options that Gin offers us for formulating responses, and sending those back to the requester. Now it's time to talk about middleware, and how that can be used to augment our application and improve its functionality. We're going to start our discussion with an introduction to what exactly middleware is. Now middleware goes by several different names, but that's the name that seems to be hanging around in the Gin community, so that's the name we're going to go with. We'll then learn how we can have one piece of middleware communicate with other pieces of middleware or the main handlers that are setup to handle each individual request. Next, we'll talk about the many pre-packaged options that Gin contains, and get an overview of what those middlewares do, and how you can use those to enhance your application. Finally, we'll talk about custom middleware. While there are many pre-packaged options available in Gin there's almost always going to be some case where you need to have your own piece of middleware to solve a unique problem. We'll talk about that as a wrap-up to this module. Okay, so let's dive in and learn exactly what middleware is anyway.