Learn to make your own web server in Golang. This coding walk-through will show you how to make your own web server with a proper graceful shutdown sequence.
If you want to make a simple web service without a ton of bloat, Golang is a super lightweight solution. This tutorial starts from scratch and explains how to create a web server using the httprouter Go package. As an added bonus, I explain the importance of having your server gracefully shut down to avoid disruption to your users.
This is part one of a series that will build a full REST API microservice in Go with an automated build process and fully deployable Helm chart for Kubernetes. Subscribe so you get notified when I post the next part of the series!
Source code (branch for this part of the series): https://github.com/askcloudarchitech/...
Full Code: https://github.com/askcloudarchitech/...
httprouter package: https://pkg.go.dev/github.com/juliens...
My website: https://askcloudarchitech.com
=======================================
I get a lot of questions about my gear so I've created a few lists of the stuff I use. These are affiliate links. If you click and literally buy anything, it helps support the channel! Thank you.
Here's a link to my home office gear: https://kit.co/AskCloudArchitech/my-h...
Here's a link to my youtube "studio" gear: https://kit.co/AskCloudArchitech/yout...
=======================================
My website for written versions of these vids: https://askcloudarchitech.com
==============================================================
00:00 - intro
00:12 - Create and clone your repo
00:45 - Initialize a Go Module
01:00 - Create the necessary files
01:18 - Scaffolding for the basic webserver
05:59 - Adding a response to the handler
06:35 - Adding a graceful shutdown process
10:20 - Startup and shutdown demonstration