Chapter 2. Go ChitChat


This chapter covers

  • Introducing Go web programming
  • Designing a typical Go web application
  • Writing a complete Go web application
  • Understanding the parts of a Go web application

Toward the end of chapter 1, we went through the simplest possible Go web application. That simple web application, I admit, is pretty useless and is nothing more than the equivalent of a Hello World application. In this chapter, we’ll explore another basic but more useful web application. We’ll be building a simple internet forum web application—one that allows users to log in and create conversations and respond to conversation topics.

By the end of the chapter, you might not have the skills to write a full-fledged web application but you’ll be able to appreciate how one can be structured and developed. Throughout this chapter you’ll see the bigger picture of how web applications can be written in Go.

If you find this chapter a bit too intimidating—especially with the rush of Go code—don’t be too alarmed. Work through the next few chapters and then revisit this one and you’ll find that things become a lot clearer!

2.1. Let’s ChitChat

2.2. Application design

2.3. Data model

2.4. Receiving and processing requests

2.5. Generating HTML responses with templates

2.6. Installing PostgreSQL

2.7. Interfacing with the database

2.8. Starting the server

2.9. Wrapping up

2.10. Summary