Mastering Go Web Services
Год издания: 2015
Автор: Nathan Kozyra
Издательство: Packt Publishing
ISBN: 9781783981304
Язык: Английский
Формат: ePub
Качество: Изначально компьютерное (eBook)
Интерактивное оглавление: Да
Количество страниц: 255
Описание: 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.
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