An error occured adding a product to your cart, you may only have 100 items in your cart.

Building RESTful Web services with Go

Explore the necessary concepts of REST API development by building few real world services from scratch.
Preview in Mapt

Building RESTful Web services with Go

Naren Yellavula

2 customer reviews
Explore the necessary concepts of REST API development by building few real world services from scratch.
Mapt Subscription
FREE
€29.73/m after trial
eBook
€29.15
RRP €41.63
Save 29%
Print + eBook
€42.99
RRP €42.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
€29.15
€42.99
€29.74 p/m after trial
RRP €41.63
RRP €42.99
Subscription
eBook
Print + eBook
Start 14 Day Trial

Frequently bought together


Building RESTful Web services with Go Book Cover
Building RESTful Web services with Go
€ 41.63
€ 29.15
Go: Design Patterns for Real-World Projects Book Cover
Go: Design Patterns for Real-World Projects
€ 82.09
€ 57.47
Buy 2 for €35.42
Save €74.20
Add to Cart

Book Details

ISBN 139781788294287
Paperback316 pages

Book Description

REST is an architectural style that tackles the challenges of building scalable web services and in today's connected world, APIs have taken a central role on the web. APIs provide the fabric through which systems interact, and REST has become synonymous with APIs. The depth, breadth, and ease of use of Go, makes it a breeze for developers to work with it to build robust Web APIs. This book takes you through the design of RESTful web services and leverages a framework like Gin
to implement these services.

The book starts with a brief introduction to REST API development and how it transformed the modern web. You will learn how to handle routing and authentication of web services along with working with middleware for internal service. The book explains how to use Go frameworks to build RESTful web services and work with MongoDB to create REST API. You will learn how to integrate Postgres SQL and JSON with a Go web service and build a client library in Go for consuming REST API. You will learn how to scale APIs using the microservice architecture and deploy the REST APIs using Nginx as a proxy server. Finally you will learn how to metricize a REST API using an API Gateway.

By the end of the book you will be proficient in building RESTful APIs in Go.

Table of Contents

Chapter 1: Getting Started with REST API Development
Types of web services
REST verbs and status codes
Rise of REST API with Single Page Applications
Setting up the project and running the development server
Building our first service – finding the Roman numeral
Using Gulp for creating auto code compiling and server reloading
Summary
Chapter 2: Handling Routing for Our REST Services
Getting the code
Understanding Go's net/http package
ServeMux, a basic router in Go
Introducing httprouter, a lightweight HTTP router
Introducing Gorilla Mux, a powerful HTTP router
Creating a basic API layout for URL shortening services
Summary 
Chapter 3: Working with Middleware and RPC
Getting the code
What is middleware? 
Multiple middleware and chaining
Painless middleware chaining with Alice
Using Gorilla's Handlers middleware for Logging 
What is RPC?
JSON RPC using Gorilla RPC
Summary
Chapter 4: Simplifying RESTful Services with Popular Go Frameworks
Getting the code
go-restful, a framework for REST API creation
CRUD operations and SQLite3 basics
Building a Metro Rail API with go-restful
Building RESTful APIs with the Gin framework
Building a RESTful API with Revel.go
Summary 
Chapter 5: Working with MongoDB and Go to Create REST APIs
Getting the code
Introduction to MongoDB
Installing MongoDB and using the shell
Introducing mgo, a MongoDB driver for Go
RESTful API with Gorilla Mux and MongoDB
Boosting the querying performance with indexing
Designing an e-commerce data document model
Summary
Chapter 6: Working with Protocol Buffers and GRPC
Getting the code
Introduction to protocol buffers
Protocol buffer language
Compiling a protocol buffer with protoc
Introduction to GRPC
Bidirectional streaming with GRPC
Summary
Chapter 7: Working with PostgreSQL, JSON, and Go
Getting the code
Installing the PostgreSQL database
pq, a pure PostgreSQL database driver for Go
Implementing a URL shortening service using Postgres and pq
Exploring the JSON store in PostgreSQL
Summary
Chapter 8: Building a REST API Client in Go and Unit Testing
Getting the code
Plan for building a REST API client
Basics for writing a command-line tool in Go
grequests – a REST API package for Go
Getting comfortable with the GitHub REST API
Creating a CLI tool as an API client for the GitHub REST API
Using Redis for caching the API data
Creating a unit testing tool for our URL shortening service
Summary
Chapter 9: Scaling Our REST API Using Microservices
Getting the code
What are microservices?
Monolith versus microservices
Go Kit, a package for building microservices
Summary
Chapter 10: Deploying Our REST services
Getting the code
Installing and configuring Nginx
Monitoring our Go API server with Supervisord
Summary
Chapter 11: Using an API Gateway to Monitor and Metricize REST API
Getting the code
Why is an API gateway required?
Kong, an open-source API gateway
Adding API to Kong
API logging in Kong
API authentication in Kong
API rate limiting in Kong
Kong CLI
Other API gateways
Summary
Chapter 12: Handling Authentication for Our REST Services
Getting the code
How authentication works
Introducing Postman, a tool for testing REST API
Persisting client sessions with Redis
Introduction to JSON Web Tokens (JWT) and OAuth2
OAuth 2 architecture and basics
Summary

What You Will Learn

  • Create HTTP handler and introspect the Gorilla Mux router
  • OAuth 2 implementation with Go
  • Build RESTFul API with Gin Framework
  • Create REST API with MongoDB and Go
  • Build a working client library and unit test for REST API
  • Debug, test, and profile RESTful APIs with each of the frameworks
  • Optimize and scale REST API using microservices

Authors

Table of Contents

Chapter 1: Getting Started with REST API Development
Types of web services
REST verbs and status codes
Rise of REST API with Single Page Applications
Setting up the project and running the development server
Building our first service – finding the Roman numeral
Using Gulp for creating auto code compiling and server reloading
Summary
Chapter 2: Handling Routing for Our REST Services
Getting the code
Understanding Go's net/http package
ServeMux, a basic router in Go
Introducing httprouter, a lightweight HTTP router
Introducing Gorilla Mux, a powerful HTTP router
Creating a basic API layout for URL shortening services
Summary 
Chapter 3: Working with Middleware and RPC
Getting the code
What is middleware? 
Multiple middleware and chaining
Painless middleware chaining with Alice
Using Gorilla's Handlers middleware for Logging 
What is RPC?
JSON RPC using Gorilla RPC
Summary
Chapter 4: Simplifying RESTful Services with Popular Go Frameworks
Getting the code
go-restful, a framework for REST API creation
CRUD operations and SQLite3 basics
Building a Metro Rail API with go-restful
Building RESTful APIs with the Gin framework
Building a RESTful API with Revel.go
Summary 
Chapter 5: Working with MongoDB and Go to Create REST APIs
Getting the code
Introduction to MongoDB
Installing MongoDB and using the shell
Introducing mgo, a MongoDB driver for Go
RESTful API with Gorilla Mux and MongoDB
Boosting the querying performance with indexing
Designing an e-commerce data document model
Summary
Chapter 6: Working with Protocol Buffers and GRPC
Getting the code
Introduction to protocol buffers
Protocol buffer language
Compiling a protocol buffer with protoc
Introduction to GRPC
Bidirectional streaming with GRPC
Summary
Chapter 7: Working with PostgreSQL, JSON, and Go
Getting the code
Installing the PostgreSQL database
pq, a pure PostgreSQL database driver for Go
Implementing a URL shortening service using Postgres and pq
Exploring the JSON store in PostgreSQL
Summary
Chapter 8: Building a REST API Client in Go and Unit Testing
Getting the code
Plan for building a REST API client
Basics for writing a command-line tool in Go
grequests – a REST API package for Go
Getting comfortable with the GitHub REST API
Creating a CLI tool as an API client for the GitHub REST API
Using Redis for caching the API data
Creating a unit testing tool for our URL shortening service
Summary
Chapter 9: Scaling Our REST API Using Microservices
Getting the code
What are microservices?
Monolith versus microservices
Go Kit, a package for building microservices
Summary
Chapter 10: Deploying Our REST services
Getting the code
Installing and configuring Nginx
Monitoring our Go API server with Supervisord
Summary
Chapter 11: Using an API Gateway to Monitor and Metricize REST API
Getting the code
Why is an API gateway required?
Kong, an open-source API gateway
Adding API to Kong
API logging in Kong
API authentication in Kong
API rate limiting in Kong
Kong CLI
Other API gateways
Summary
Chapter 12: Handling Authentication for Our REST Services
Getting the code
How authentication works
Introducing Postman, a tool for testing REST API
Persisting client sessions with Redis
Introduction to JSON Web Tokens (JWT) and OAuth2
OAuth 2 architecture and basics
Summary

Book Details

ISBN 139781788294287
Paperback316 pages
Read More
From 2 reviews

Read More Reviews

Recommended for You

Go: Design Patterns for Real-World Projects Book Cover
Go: Design Patterns for Real-World Projects
€ 82.09
€ 57.47
Isomorphic Go Book Cover
Isomorphic Go
€ 45.20
€ 31.65
Architecting Modern Java EE Applications Book Cover
Architecting Modern Java EE Applications
€ 45.20
€ 9.04
DevOps with Kubernetes Book Cover
DevOps with Kubernetes
€ 45.20
€ 31.65
Building Web Services with Java EE 8 [Video] Book Cover
Building Web Services with Java EE 8 [Video]
€ 124.93
€ 24.99
Master Java Web Services and REST API with Spring Boot [Video] Book Cover
Master Java Web Services and REST API with Spring Boot [Video]
€ 196.33
€ 39.27