Linux serverlinux web serverNETWORK ADMINISTRATIONS

Let's build a REST API in Go with zero dependencies!

You already saw me use my “go-rollercoaster-api”, a simple REST API written in Golang, in the curl tutorial. In this video we’re rebuilding the entire HTTP server from Scratch in Go! And to make the challenge more fun I’ve defined some requirements (dictated by the capabilities I needed for the curl video). But that’s not nearly all: During the entire video I’m not using any third-party packages, only the standard libraries that come with Go!

This video is not necessarily meant as a tutorial as I won’t go into as much detail as I would in the other tutorials, but it’s your change to pair-program with me for 50 minutes straight and watch me build a full REST API in one of my favorite programming languages: Golang. And it wouldn’t be me if I wasn’t using my favorite text editor in the world: vim. So be prepared for almost an hour packed full of Golang, vim, vim-go and probably a lot of compilation errors. 😉

We’re going to build GET and POST handlers to add and see our rollercoasters, we’ll store them in a simple in-memory store, protected against concurrent read/writes using a Mutex and there’ll even be a route that redirects you to a random coaster, as well as a section of the app protected by Basic Auth! Join the ride (pun intended!) and let’s have fun building this small app.

You can finde the code from the video on GitHub: https://github.com/kubucation/go-rollercoaster-api

Thumbnail contains Gopher image by Takuya Ueda (https://twitter.com/tenntenn). Licensed under the Creative Commons 3.0 Attributions license. (http://creativecommons.org/licenses/by/3.0/deed.ja)

source

by kubucation

linux http server

Leave a Reply

Your email address will not be published. Required fields are marked *