Go Web Development Cookbook

86 recipes on how to build fast, scalable, and powerful web services and applications with Go
Preview in Mapt

Go Web Development Cookbook

Arpit Aggarwal
New Release!

86 recipes on how to build fast, scalable, and powerful web services and applications with Go
Mapt Subscription
FREE
$29.99/m after trial
eBook
$7.20
RRP $35.99
Save 79%
Print + eBook
$44.99
RRP $44.99
What do I get with a Mapt Pro subscription?
  • Unlimited access to all Packt’s 5,000+ eBooks and Videos
  • Early Access content, Progress Tracking, and Assessments
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
$0.00
$7.20
$44.99
$29.99 p/m after trial
RRP $35.99
RRP $44.99
Subscription
eBook
Print + eBook
Start 14 Day Trial

Frequently bought together


Go Web Development Cookbook Book Cover
Go Web Development Cookbook
$ 35.99
$ 7.20
Go Network Programming Cookbook Book Cover
Go Network Programming Cookbook
$ 35.99
$ 10.00
Buy 2 for $17.20
Save $54.78
Add to Cart

Book Details

ISBN 139781787286740
Paperback338 pages

Book Description

Go is an open source programming language that is designed to scale and support concurrency at the language level. This gives you the liberty to write large concurrent web applications with ease. From creating web application to deploying them on Amazon Cloud Services, this book will be your one-stop guide to learn web development in Go. The Go Web Development Cookbook teaches you how to create REST services, write microservices, and deploy Go Docker containers. Whether you are new to programming or a professional developer, this book will help get you up to speed with web development in Go. We will focus on writing modular code in Go; in-depth informative examples build the base, one step at a time. You will learn how to create a server, work with static files, SQL, NoSQL databases, and Beego. You will also learn how to create and secure REST services, and create and deploy Go web application and Go Docker containers on Amazon Cloud Services. By the end of the book, you will be able to apply the skills you've gained in Go to create and explore web applications in any domain.

Table of Contents

Chapter 1: Creating Your First Server in Go
Introduction
Creating a simple HTTP server
Implementing basic authentication on a simple HTTP server
Optimizing HTTP server responses with GZIP compression
Creating a simple TCP server
Reading data from a TCP connection
Writing data to a TCP connection
Implementing HTTP request routing
Implementing HTTP request routing using Gorilla Mux
Logging HTTP requests
Chapter 2: Working with Templates, Static Files, and HTML Forms
Introduction
Creating your first template
Serving static files over HTTP
Serving static files over HTTP using Gorilla Mux
Creating your first HTML form
Reading your first HTML form
Validating your first HTML form
Uploading your first file
Chapter 3: Working with Sessions, Error Handling, and Caching in Go
Introduction
Creating your first HTTP session
Managing your HTTP session using Redis
Creating your first HTTP cookie
Implementing caching in Go
Implementing HTTP error handling in Go
Implementing login and logout in web application
Chapter 4: Writing and Consuming RESTful Web Services in Go
Introduction
Creating your first HTTP GET method
Creating your first HTTP POST method
Creating your first HTTP PUT method
Creating your first HTTP DELETE method
Versioning your REST API
Creating your first REST client
Creating your first AngularJS Client
Creating your first ReactJS client
Creating your first VueJS client
Chapter 5: Working with SQL and NoSQL Databases
Introduction
Integrating MySQL and Go
Creating your first record in MySQL
Reading records from MySQL
Updating your first record in MySQL
Deleting your first record from MySQL
Integrating MongoDB and Go
Creating your first document in MongoDB
Reading documents from MongoDB
Updating your first document in MongoDB
Deleting your first document from MongoDB
Chapter 6: Writing Microservices in Go Using Micro – a Microservice Toolkit
Introduction
Creating your first protocol buffer
Spinning up a microservice discovery client
Creating your first microservice
Creating your second microservice
Creating your Micro API
Interacting with microservices using a command-line interface and web UI
Chapter 7: Working with WebSocket in Go
Introduction
Creating your first WebSocket server
Creating your first WebSocket client
Debugging your first local WebSocket server
Debugging your first remote WebSocket server
Unit testing your first WebSocket server
Chapter 8: Working with the Go Web Application Framework – Beego
Introduction
Creating your first project using Beego
Creating your first controller and router
Creating your first view
Creating your first session variable
Creating your first filter
Handling HTTP errors in Beego
Implementing caching in Beego
Monitoring the Beego application
Deploying the Beego application on a local machine
Deploying the Beego application with Nginx
Chapter 9: Working with Go and Docker
Introduction
Building your first Go Docker image
Running your first Go Docker container
Pushing your Docker image to the Docker Registry
Creating your first user-defined bridge network
Running a MySQL Docker image on a user-defined bridge network
Building a Go web application Docker image
Running a web application Docker container linked with a MySQL Docker container on a user-defined bridge network
Chapter 10: Securing a Go Web Application
Introduction
Creating a private key and SSL certificate using OpenSSL
Moving an HTTP server to HTTPS
Defining REST APIs and routes
Creating a JSON web token
Securing a RESTful service using a JSON web token
Preventing cross-site request forgery in Go web applications
Chapter 11: Deploying a Go Web App and Docker Containers to AWS
Introduction
Creating your first EC2 instance to run a Go web application
Interacting with your first EC2 instance
Creating, copying, and running a Go web application on your first EC2 instance
Setting up an EC2 instance to run a Docker container
Pulling a Docker image on an AWS EC2 instance from Docker Hub
Running your Go Docker container on an EC2 instance

What You Will Learn

  • Create a simple HTTP and TCP web server and understand how it works
  • Explore record in a MySQL and MongoDB database
  • Write and consume RESTful web service in Go
  • Invent microservices in Go using Micro – a microservice toolkit
  • Create and Deploy the Beego application with Nginx
  • Deploy Go web application and Docker containers on an AWS EC2 instance

Authors

Table of Contents

Chapter 1: Creating Your First Server in Go
Introduction
Creating a simple HTTP server
Implementing basic authentication on a simple HTTP server
Optimizing HTTP server responses with GZIP compression
Creating a simple TCP server
Reading data from a TCP connection
Writing data to a TCP connection
Implementing HTTP request routing
Implementing HTTP request routing using Gorilla Mux
Logging HTTP requests
Chapter 2: Working with Templates, Static Files, and HTML Forms
Introduction
Creating your first template
Serving static files over HTTP
Serving static files over HTTP using Gorilla Mux
Creating your first HTML form
Reading your first HTML form
Validating your first HTML form
Uploading your first file
Chapter 3: Working with Sessions, Error Handling, and Caching in Go
Introduction
Creating your first HTTP session
Managing your HTTP session using Redis
Creating your first HTTP cookie
Implementing caching in Go
Implementing HTTP error handling in Go
Implementing login and logout in web application
Chapter 4: Writing and Consuming RESTful Web Services in Go
Introduction
Creating your first HTTP GET method
Creating your first HTTP POST method
Creating your first HTTP PUT method
Creating your first HTTP DELETE method
Versioning your REST API
Creating your first REST client
Creating your first AngularJS Client
Creating your first ReactJS client
Creating your first VueJS client
Chapter 5: Working with SQL and NoSQL Databases
Introduction
Integrating MySQL and Go
Creating your first record in MySQL
Reading records from MySQL
Updating your first record in MySQL
Deleting your first record from MySQL
Integrating MongoDB and Go
Creating your first document in MongoDB
Reading documents from MongoDB
Updating your first document in MongoDB
Deleting your first document from MongoDB
Chapter 6: Writing Microservices in Go Using Micro – a Microservice Toolkit
Introduction
Creating your first protocol buffer
Spinning up a microservice discovery client
Creating your first microservice
Creating your second microservice
Creating your Micro API
Interacting with microservices using a command-line interface and web UI
Chapter 7: Working with WebSocket in Go
Introduction
Creating your first WebSocket server
Creating your first WebSocket client
Debugging your first local WebSocket server
Debugging your first remote WebSocket server
Unit testing your first WebSocket server
Chapter 8: Working with the Go Web Application Framework – Beego
Introduction
Creating your first project using Beego
Creating your first controller and router
Creating your first view
Creating your first session variable
Creating your first filter
Handling HTTP errors in Beego
Implementing caching in Beego
Monitoring the Beego application
Deploying the Beego application on a local machine
Deploying the Beego application with Nginx
Chapter 9: Working with Go and Docker
Introduction
Building your first Go Docker image
Running your first Go Docker container
Pushing your Docker image to the Docker Registry
Creating your first user-defined bridge network
Running a MySQL Docker image on a user-defined bridge network
Building a Go web application Docker image
Running a web application Docker container linked with a MySQL Docker container on a user-defined bridge network
Chapter 10: Securing a Go Web Application
Introduction
Creating a private key and SSL certificate using OpenSSL
Moving an HTTP server to HTTPS
Defining REST APIs and routes
Creating a JSON web token
Securing a RESTful service using a JSON web token
Preventing cross-site request forgery in Go web applications
Chapter 11: Deploying a Go Web App and Docker Containers to AWS
Introduction
Creating your first EC2 instance to run a Go web application
Interacting with your first EC2 instance
Creating, copying, and running a Go web application on your first EC2 instance
Setting up an EC2 instance to run a Docker container
Pulling a Docker image on an AWS EC2 instance from Docker Hub
Running your Go Docker container on an EC2 instance

Book Details

ISBN 139781787286740
Paperback338 pages
Read More

Read More Reviews

Recommended for You

Go Network Programming Cookbook Book Cover
Go Network Programming Cookbook
$ 35.99
$ 10.00
Go Standard Library Cookbook Book Cover
Go Standard Library Cookbook
$ 39.99
$ 10.00
Mastering Go Book Cover
Mastering Go
$ 39.99
$ 10.00
Building RESTful Web services with Go Book Cover
Building RESTful Web services with Go
$ 35.99
$ 7.20
Isomorphic Go Book Cover
Isomorphic Go
$ 39.99
$ 8.00
Security with Go Book Cover
Security with Go
$ 31.99
$ 10.00