更新时间:2021-06-24 17:04:55
封面
Title Page
Copyright and Credits
Hands-On RESTful Web Services with Go Second Edition
Dedication
About Packt
Why subscribe?
Contributors
About the author
About the reviewer
Packt is searching for authors like you
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Download the color images
Conventions used
Get in touch
Reviews
Getting Started with REST API Development
Technical requirements
Types of web services
The REST API
Characteristics of REST services
REST verbs and status codes
GET
Examples of path parameters
POST PUT and PATCH
DELETE and OPTIONS
Cross-Origin Resource Sharing (CORS)
The rise of the REST API with SPAs
Old and new methods of data flow in SPA
Why use Go for REST API development?
Setting up the project and running the development server
Demystifying GOPATH
Building our first service – finding the fastest mirror site from a list
Open API and Swagger
Installing Swagger UI
Summary
Handling Routing for our REST Services
Understanding Go's net/http package
ServeMux – a basic router in Go
Developing a UUID generation API using ServeMux
Adding multiple handlers using ServeMux
Understanding httprouter – a lightweight HTTP router
Installing httprouter
Building a simple static file server in minutes
Introducing gorilla/mux – a powerful HTTP router
Installing gorilla/mux
Fundamentals of gorilla/mux
Path-based matching
Query-based matching
Other notable features of gorilla/mux
SQL injection in URLs and ways to avoid them
Reader's challenge – an API for URL shortening
Working with Middleware and RPC
What is middleware?
Creating a basic middleware
Multiple middleware and chaining
Painless middleware chaining with Alice
Using Gorilla handlers middleware for logging
What is RPC?
Creating an RPC server
Creating an RPC client
JSON-RPC using Gorilla RPC
Simplifying RESTful Services with Popular Go Frameworks
Introducing go-restful – a REST API framework
SQLite3 basics and CRUD operations
Building a Metro Rail API with go-restful
Design specification
Creating database models
Building RESTful API with the Gin framework
Building a RESTful API with revel.go
Working with MongoDB and Go to Create a REST API
Introduction to MongoDB
Installing MongoDB and using the shell
Working with the MongoDB shell
Introducing mongo-driver an official MongoDB driver for Go
RESTful API with gorilla/mux and MongoDB
Boosting the querying performance with indexing
Designing MongoDB documents for a delivery logistics API
Working with Protocol Buffers and gRPC
Introduction to protocol buffers
Protocol buffer language
Scalar values
Enumerations and repeated fields
Nested fields
Compiling a protocol buffer with protoc
Introduction to gRPC
Bidirectional streaming with gRPC