My Account Log in

1 option

Modern REST API Development in Go : Design Performant, Secure, and Observable Web APIs Using Go's Powerful Standard Library.

O'Reilly Online Learning: Academic/Public Library Edition Available online

View online
Format:
Book
Author/Creator:
Espino, Jesús.
Language:
English
Subjects (All):
Application program interfaces (Computer software).
Go (Computer program language).
Representational State Transfer (Software architecture).
Physical Description:
1 online resource (295 pages)
Edition:
1st ed.
Place of Publication:
Birmingham : Packt Publishing, Limited, 2025.
Summary:
"""Modern REST API Development in Go"" is a practical guide that teaches you how to design and implement proficient web APIs using Go. With a real-world project to follow, this book focuses on important aspects such as scalability, security, and observability. By leveraging Go's standard library alongside popular tools, you will acquire a deep understanding of REST API development. What this Book will help me do Design and build RESTful APIs following modern practices and principles. Secure your APIs using authentication and authorization techniques such as JWT. Enable API observability by implementing logging, metrics, and tracing. Write and maintain unit and integration tests for your API endpoints. Generate and integrate OpenAPI documentation for improved usability and transparency. Author(s) Jesús Espino is an experienced backend developer with a profound understanding of Go and REST API design. With years of hands-on experience building web services and a passion for teaching, Jesús brings a practical perspective to solving real-world problems. He writes with clarity, focusing on actionable knowledge to empower developers. Who is it for? This book is ideal for developers aiming to master REST API development in Go. Whether you're a backend engineer seeking to build secure and scalable APIs, or a developer intrigued by Go's programming model, this book provides the insights and practice needed. Newcomers to Go will also benefit from its engaging, project-based approach to learning foundational principles.".
Contents:
Cover
Copyright
Contributors
Table of Contents
Preface
Chapter 1: Introduction to APIs
Getting the most out of this book - get to know your free benefits
Next-gen reader
Interactive AI assistant (beta)
DRM-free PDF or ePub version
Technical requirements
What's an API?
GraphQL
gRPC
SOAP
Custom API
What's REST?
REST concepts
REST and HTTP
Other HTTP features used in REST
Why use Go for API development?
Building a simple API in Go
Creating the project
Writing a "Hello World" program
Running your server
Accessing the API
Creating the client project
Writing the API client
Running the client
Summary
Chapter 2: Exploring REST APIs
OpenAPI
The OpenAPI file
OpenAPI example
OpenAPI documentation example
Postman
Importing an API
Exploring API endpoints
Sending requests using Postman
curl
Getting information
Sending information
Diving deeper into the details
Chapter 3: Building a REST Client
The Go HTTP client
Customizing the client
Customizing the request
Request and Response objects
The request object
The response object
Building your API client
Chapter 4: Designing Your REST API
HTTP methods and status codes
HTTP methods
GET
POST
PUT
PATCH
DELETE
HTTP status codes
2XX
3XX
4XX
5XX
Understanding routing
Middleware
API versioning
Building a CRUD API
Basic structure
The creation endpoint
The list endpoint
The delete endpoint
The update endpoint
The retrieve endpoint
The add-to-list action endpoint
Chapter 5: Authentication and Authorization
Basic authentication
Token-based authentication
Server session token
JWT.
Creating a JWT
Retrieving user information
Authorization using the RBAC approach
Adding authentication to our API
Adding authorization to our API
Chapter 6: Data Persistency
Creating and accessing your database
The repository pattern
The sql package
Querying
Transactions
Using a query builder
Adding persistence to your API
Chapter 7: API Security
Input validation and sanitization
Incorrect data validation threats
Injection attacks
XSS attacks
Data validation
Sanitization
Password handling
HTTP security features
CSP
CORS
Content-Type
HTTPS with Let's Encrypt
Adding CORS to our API
Adding HTTPS to our API
Chapter 8: API Performance
HTTP cache
Cache control
Cache revalidation
ETag
Server cache
Go performance
Profiling
Benchmarks
Adding HTTP headers to your API
Adding an in-memory cache to your API
Chapter 9: Deploying Your API
Technical Requirements
Selecting the correct deployment for you
Bare metal
Virtual server
Containers
Kubernetes
FaaS
Bare-metal/VM deployment
Container deployment
Kubernetes deployment
Chapter 10: Testing
How do you test your API?
Unit tests
Integration tests
E2E testing
Unit testing and mocks
Subtests
Table-driven tests
Mocks
The testify library
Integration testing
The testcontainers library
Adding tests to our shopping list API
Chapter 11: Documenting with OpenAPI
What is OpenAPI?
The OpenAPI format
Documenting your endpoints
Writing code and OpenAPI documents
Generating code from your OpenAPI document.
Generating an OpenAPI document from your code
Publishing your API documentation
Using OpenAPI for documentation
API testing
Client code generation
Adding OpenAPI documentation to your API
Chapter 12: Metrics, Logs, and Traces
Why do we need logs, metrics, and traces?
Logs
Structured logging
OTel logging
Metrics
Visualizing the metrics
Traces
Visualizing traces
Adding observability to our project
Logging
Chapter 13: Using GORM
What is GORM?
When to use GORM
Setting up GORM
Creating models in GORM
CRUD operations with GORM
Creating a user
Reading records
Updating records
Deleting records
Working with relationships
Interesting GORM features
Integrating GORM into our shopping list API
Chapter 14: Using the Echo Framework
What is Echo?
When to use Echo
Setting up Echo
Echo handlers
Echo middleware
Error handling
Migrating our shopping list API to Echo
Migrating handlers
Migrating middleware
Additional features with Echo
Chapter 14: Unlock Your Book's Exclusive Benefits
How to unlock these benefits in three easy steps
Other Books You May Enjoy
Index.
Notes:
Description based on publisher supplied metadata and other sources.
ISBN:
9781836205364
OCLC:
1530380323
Publisher Number:
CIPO000262623

The Penn Libraries is committed to describing library materials using current, accurate, and responsible language. If you discover outdated or inaccurate language, please fill out this feedback form to report it and suggest alternative language.

Find

Home Release notes

My Account

Shelf Request an item Bookmarks Fines and fees Settings

Guides

Using the Find catalog Using Articles+ Using your account