Go Web Programming
312 pages
English
PDF
4.5

Go Web Programming

Go Web Programming

Author:

Year:

Summary:

Introduction

The book «Go Web Programming» (author — Sau Sheong Chang, 2016, 312 pages) is a practical guide to creating web applications in the Go language (Golang). Unlike many other books that focus on syntax or language fundamentals, this work immediately immerses the reader in the world of web development: from a simple HTTP server to a full-fledged application with databases, templates, and security. The book is written in a lively, accessible language and contains many code examples that can be immediately run and modified.

What the book is about

The book consists of 12 chapters, logically divided into three parts. The first part introduces the basics of Go and the web server: environment setup, request handling, routing. The second part is devoted to key components of a web application: working with templates (html/template), databases (using PostgreSQL as an example), sessions, authentication, and security. The third part covers advanced topics: testing web applications, using third-party libraries (e.g., Gorilla Toolkit), and deploying the finished application on a server.

Who this book is for

The book is intended for developers who already have a basic understanding of Go (syntax, data types, functions) and want to learn how to create web applications. It will be useful both for beginners in web development and for experienced programmers transitioning from other languages (Python, Ruby, PHP) to Go. If you already know how to write console programs in Go but don't know how to create a REST API or a dynamic website — this book is for you.

What the reader will learn

  • Basics of a web server in Go: creating handlers, working with HTTP requests and responses, routing.
  • Templating: using the html/template package to generate HTML pages, passing data to templates, safe escaping.
  • Working with databases: connecting to PostgreSQL, executing SQL queries, using ORM-like libraries (e.g., GORM).
  • Session management and authentication: creating cookie sessions, password hashing, protection against CSRF attacks.
  • Testing: writing unit tests for handlers, integration testing using httptest.
  • Deployment: building a binary file, running on a server, using Docker for containerization.

Strengths

One of the main advantages of the book is its practical focus. Each chapter contains not only theory but also complete examples that can be assembled into a full-fledged application. The author consistently guides the reader from simple to complex, without overloading with unnecessary details. The chapter on security deserves special mention: it covers typical web application vulnerabilities (SQL injection, XSS, CSRF) and ways to prevent them in Go. The book was written in 2016, but the core concepts and packages (net/http, html/template, database/sql) remain relevant today. For beginners, this is an excellent starting point, and experienced developers will find useful patterns and techniques.

Who it is recommended for

The book is recommended for anyone who wants to master web development in Go: backend developers, fullstack programmers, students of technical specialties. It will also be useful for those who already write in Go but want to systematize their knowledge of web frameworks and best practices. If you are looking for a book that not only talks about syntax but teaches you how to create real web applications — «Go Web Programming» will be an excellent choice.

Recommendations