Mastering Go Web Services

Program and deploy fast, scalable web services and create high-performance RESTful APIs using Go
Preview in Mapt

Mastering Go Web Services

Nathan Kozyra

1 customer reviews
Program and deploy fast, scalable web services and create high-performance RESTful APIs using Go

Quick links: > What will you learn?> Table of content> Product reviews

Mapt Subscription
FREE
$20.83/m after trial
eBook
$5.00
RRP $39.99
Save 87%
Print + eBook
$49.99
RRP $49.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
$5.00
$49.99
$29.99 p/m after trial
RRP $39.99
RRP $49.99
Subscription
eBook
Print + eBook
Start 14 Day Trial

Frequently bought together


Mastering Go Web Services Book Cover
Mastering Go Web Services
$ 39.99
$ 5.00
Learning Go Programming Book Cover
Learning Go Programming
$ 39.99
$ 5.00
Buy 2 for $10.00
Save $69.98
Add to Cart

Book Details

ISBN 139781783981304
Paperback264 pages

Book Description

This book will take you through the most important aspects of designing, building, and deploying a web service utilizing idiomatic REST practices with a focus on speed, security, and flexibility. You will begin by building your first API in Go using the HTTP package. You will look at designing and building your application including popular design structures like Model-View-Controller. You will also understand methods for deploying code to staging and development. Finally, you will see how the security features in Go can be used for protection against SQL injection, and sensitive data compromise.

By the end of this book, you will have achieved a high level of proficiency in building and deploying web services and web APIs with Go.

Table of Contents

Chapter 1: Our First API in Go
Understanding requirements and dependencies
Introducing the HTTP package
Building our first route
Setting data via HTTP
Serving data from the datastore to the client
Summary
Chapter 2: RESTful Services in Go
Designing our application
Looking at REST
Other API architectures
Choosing formats
Comparing the HTTP actions and methods
Bringing in CRUD
Adding more endpoints
Handling API versions
Allowing pagination with the link header
Summary
Chapter 3: Routing and Bootstrapping
Writing custom routers in Go
Using more advanced routers in Gorilla
Using Gorilla for JSON-RPC
Using services for API access
Using a simple interface for API access
Returning valuable error information
Handling binary data
Summary
Chapter 4: Designing APIs in Go
Designing our social network API
Handling our API versions
Concurrent WebSockets
Separating our API logic
Expanding our error messages
Updating our users via the web service
Summary
Chapter 5: Templates and Options in Go
Sharing our OPTIONS
Implementing alternative formats
Rolling our own data representation format
Introducing security and authentication
Letting users register and authenticate
Examining OAuth in Go
Making requests on behalf of users
Summary
Chapter 6: Accessing and Using Web Services in Go
Connecting our users to other services
Using data from other OAuth services
Connecting securely as a client in Go
Summary
Chapter 7: Working with Other Web Technologies
Serving Go through a reverse proxy
Using Go with Apache
Go and NGINX as reverse proxies
Enabling sessions for the API
Using NoSQL in Go
Enabling connections using a username and password
Allowing our users to connect to each other
Summary
Chapter 8: Responsive Go for the Web
Creating a frontend interface
Logging in
Using client-side frameworks with Go
jQuery
Setting up an API-consuming frontend
Viewing other users
Rendering frameworks on the server side in Go
Creating a status update
Summary
Chapter 9: Deployment
Project structures
Using process control to keep your API running
Deploying with Docker
Deploying in cloud environments
Handling binary data and CDNs
RabbitMQ with Go
Summary
Chapter 10: Maximizing Performance
Using middleware to reduce cruft
Rate limiting in Go
Implementing SPDY
Summary
Chapter 11: Security
Handling error logging for security
Preventing brute-force attempts
Handling basic authentication in Go
Handling input validation and injection mitigation
Validating output
Using server-side frameworks in Go
Summary

What You Will Learn

  • Familiarize yourself with RESTful practices and apply them in Go
  • Acquaint yourself with the best practices for API design such as URL routing and HTTP response methods
  • Utilize useful middleware and frameworks to augment applications otherwise relying on pure Go
  • Understand the basic and complex authentication models for APIs
  • Deploy your code to staging and development environments
  • Look at ways to make your Go web services as speedy and thrifty as possible
  • Secure your web services
  • Ingest your own API and make it appealing to other developers

Authors

Table of Contents

Chapter 1: Our First API in Go
Understanding requirements and dependencies
Introducing the HTTP package
Building our first route
Setting data via HTTP
Serving data from the datastore to the client
Summary
Chapter 2: RESTful Services in Go
Designing our application
Looking at REST
Other API architectures
Choosing formats
Comparing the HTTP actions and methods
Bringing in CRUD
Adding more endpoints
Handling API versions
Allowing pagination with the link header
Summary
Chapter 3: Routing and Bootstrapping
Writing custom routers in Go
Using more advanced routers in Gorilla
Using Gorilla for JSON-RPC
Using services for API access
Using a simple interface for API access
Returning valuable error information
Handling binary data
Summary
Chapter 4: Designing APIs in Go
Designing our social network API
Handling our API versions
Concurrent WebSockets
Separating our API logic
Expanding our error messages
Updating our users via the web service
Summary
Chapter 5: Templates and Options in Go
Sharing our OPTIONS
Implementing alternative formats
Rolling our own data representation format
Introducing security and authentication
Letting users register and authenticate
Examining OAuth in Go
Making requests on behalf of users
Summary
Chapter 6: Accessing and Using Web Services in Go
Connecting our users to other services
Using data from other OAuth services
Connecting securely as a client in Go
Summary
Chapter 7: Working with Other Web Technologies
Serving Go through a reverse proxy
Using Go with Apache
Go and NGINX as reverse proxies
Enabling sessions for the API
Using NoSQL in Go
Enabling connections using a username and password
Allowing our users to connect to each other
Summary
Chapter 8: Responsive Go for the Web
Creating a frontend interface
Logging in
Using client-side frameworks with Go
jQuery
Setting up an API-consuming frontend
Viewing other users
Rendering frameworks on the server side in Go
Creating a status update
Summary
Chapter 9: Deployment
Project structures
Using process control to keep your API running
Deploying with Docker
Deploying in cloud environments
Handling binary data and CDNs
RabbitMQ with Go
Summary
Chapter 10: Maximizing Performance
Using middleware to reduce cruft
Rate limiting in Go
Implementing SPDY
Summary
Chapter 11: Security
Handling error logging for security
Preventing brute-force attempts
Handling basic authentication in Go
Handling input validation and injection mitigation
Validating output
Using server-side frameworks in Go
Summary

Book Details

ISBN 139781783981304
Paperback264 pages
Read More
From 1 reviews

Read More Reviews

Recommended for You

Learning Go Programming Book Cover
Learning Go Programming
$ 39.99
$ 5.00
Go Programming Blueprints - Second Edition Book Cover
Go Programming Blueprints - Second Edition
$ 39.99
$ 5.00
Go: Building Web Applications Book Cover
Go: Building Web Applications
$ 67.99
$ 5.00
Learning Go Web Development Book Cover
Learning Go Web Development
$ 23.99
$ 5.00
Go Design Patterns Book Cover
Go Design Patterns
$ 39.99
$ 5.00
Mastering Concurrency in Go Book Cover
Mastering Concurrency in Go
$ 30.99
$ 5.00