In this book we’ll be building a web application called Snippetbox, which lets people paste and share snippets of text — a bit like Pastebin or GitHub’s Gists. Towards the end of the build it will look a bit like this:
Our application will start off super simple, with just one web page. Then with each chapter we’ll build it up step-by-step until a user is able save and view snippets via the app. This will take us through topics like how to structure a project, routing requests, working with a database, processing forms and displaying dynamic data safely.
Then later in the book we’ll add user accounts, and restrict the application so that only registered users can create snippets. This will take us through more advanced topics like configuring a HTTPS server, session management, user authentication and middleware.
This book is designed for people who are new to Go, but you’ll probably find it more enjoyable if you have a general understanding of Go’s syntax first. If you find yourself struggling with the syntax, the Little Book of Go by Karl Seguin is a fantastic tutorial, or if you want something more interactive I recommend running through the Tour of Go.
I’ve also assumed that you’ve got a (very) basic understanding of HTML/CSS and SQL, and some familiarity with using your terminal (or command line for Windows users). If you’ve built a web application in any other language before — whether it’s Ruby, Python, PHP or C# — then this book should be a good fit for you.
In terms of software, you’ll need a working installation of Go (version 1.13), a text editor and a web browser.
We’ll also use Curl in a few places throughout the book to inspect the responses that our application sends. Curl should be pre-installed on most Macs, and Linux/Unix users should find in their package repositories as
curl. Windows users can download it from here.
Throughout this book code blocks are shown with a silver background like below. If the code is particularly long, parts that aren’t relevant may be replaced with an ellipsis. To make it easy to follow along, most code blocks also have a title bar at the top indicating the name of the file that we’re working on.
Terminal (command line) instructions are show with a black background and start with a dollar symbol. These commands should work on any Unix-based operating system, including Mac OSX and Linux. Sample output is shown in silver beneath the command.
If you’re using Windows, you should replace the command with the DOS equivalent or carry out the action via the normal Windows GUI.
Some chapters in this book end with an additional information section. These sections contain information that isn’t relevant to our application build, but is still important (or sometimes, just interesting) to know about. If you’re very new to Go, you might want to skip these parts and circle back to them later.
About the Author
Hey, I’m Alex Edwards, a full-stack web developer. I began working with Go 6 years ago in 2013, and have been teaching people and writing about the language for nearly as long.
I’ve used Go to build a variety of production applications, from simple websites to high-frequency trading systems. I also maintain several open-source Go packages, including the popular session management system SCS.
I live near Innsbruck, Austria. You can follow me on GitHub, Instagram, Twitter and on my blog.
Copyright and Disclaimer
Let’s Go: Learn to build professional web applications with Go. Copyright © 2019 Alex Edwards.
Last updated 2020-01-18 18:22:40 UTC. Version 1.3.1.
The Go gopher was designed by Renee French and is used under the Creative Commons 3.0 Attributions license.
The information provided within this book is for general informational purposes only. While the author and publisher have made every effort to ensure the accuracy of the information within this book was correct at time of publication there are no representations or warranties, express or implied, about the completeness, accuracy, reliability, suitability or availability with respect to the information, products, services, or related graphics contained in this book for any purpose. Any use of this information is at your own risk.