Book description
86 recipes on how to build fast, scalable, and powerful web services and applications with Go
About This Book- Become proficient in RESTful web services
- Build scalable, high-performant web applications in Go
- Get acquainted with Go frameworks for web development
This book is for Go developers interested in learning how to use Go to build powerful web applications. A background in web development is expected.
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
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.
Style and approachThis book helps you learn core Go concepts faster by taking a recipe-based approach.
Table of contents
- Title Page
- Copyright and Credits
- Dedication
- Packt Upsell
- Contributors
- Preface
-
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
- Working with Templates, Static Files, and HTML Forms
- Working with Sessions, Error Handling, and Caching in Go
-
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
-
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
- Writing Microservices in Go Using Micro – a Microservice Toolkit
- Working with WebSocket in Go
-
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
-
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
- Securing a Go Web Application
-
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
- Other Books You May Enjoy
Product information
- Title: Go Web Development Cookbook
- Author(s):
- Release date: April 2018
- Publisher(s): Packt Publishing
- ISBN: 9781787286740
You might also like
book
Go Web Programming
Go Web Programming teaches you how to build scalable, high-performance web applications in Go using modern …
book
Full-Stack Web Development with Go
A Go programmer's hands-on guide to go from building basic server-side templates to full single page …
video
Building full-stack web applications with Go
Building full stack web applications requires drawing on several big technologies, including database access, HTTP routing, …
book
Node.js Web Development
Build scalable web applications using Node.js, Express.js, and the latest ECMAScript techniques, along with deploying applications …