Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Modern REST API Development in Go

You're reading from   Modern REST API Development in Go Design performant, secure, and observable web APIs using Go's powerful standard library

Arrow left icon
Product type Paperback
Published in Aug 2025
Publisher Packt
ISBN-13 9781836205371
Length 294 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Jesús Espino Jesús Espino
Author Profile Icon Jesús Espino
Jesús Espino
Arrow right icon
View More author details
Toc

Table of Contents (18) Chapters Close

Preface 1. Introduction to APIs 2. Exploring REST APIs FREE CHAPTER 3. Building a REST Client 4. Designing Your REST API 5. Authentication and Authorization 6. Data Persistency 7. API Security 8. API Performance 9. Deploying Your API 10. Testing 11. Documenting with OpenAPI 12. Metrics, Logs, and Traces 13. Using GORM 14. Using the Echo Framework 15. Unlock Your Book’s Exclusive Benefits 16. Other Books You May Enjoy
17. Index

Why use Go for API development?

First, there are very good reasons to use Go for API development, and they’re the same for other languages. I’m heavily biased because I love the Go programming language for multiple reasons. Still, I’m going to explain why I think Go is a great language for API development and why I think it’s ahead of other languages.

One of the main reasons is the language itself. If you know Go, you already know how simple, elegant, and fast it can be. Having a language that keeps your problem straightforward is ideal for REST API development. Go tends to provide low-complexity solutions and avoid boilerplate code. APIs are often created as small functions that give access to your logic. A language that gets straight to the point and allows you to write that code succinctly and directly is a blessing in this context.

Another good reason why you should use Go for REST is its extensive standard library, which provides you with most of the building blocks you’ll need to build an API without any external dependencies. JSON encoding/decoding, HTTP servers, URL routing, query parameters parsing, and header handling are all built into the standard library. When you start writing your API in Go, you already have all that you need to build the API. You may need some other libraries, depending on the project, but even if that’s required, the Go ecosystem surrounding APIs is, in general, very mature.

Apart from the standard library, the language itself provides particular advantages when you’re working with programs that operate concurrently, such as an API where you have multiple clients consuming that API at the same time. In those scenarios, its built-in concurrency primitives and lightweight processes (goroutines) make your applications ultra-performant out of the box, almost without you needing to think about it. The built-in HTTP server handles the requests in independent goroutines, so your API will be running concurrently, even if you don’t use goroutines anywhere in your code.

There are other popular language options out there for API development, from Python to Rust to others such as C# and Java. But, from my experience, Go falls in the sweet spot between performance, a high degree of control, development speed, and robustness. Of course, I’m biased because Go is my language of choice, but I’ve worked with other languages, and I haven’t found something in the same sweet spot that Go has for building APIs.

In conclusion, you can build APIs with any language, but not all of them provide the same value as Go. While we explore this in this book, I will show you how good Go is at writing APIs and how far you can go using the standard library almost exclusively.

lock icon The rest of the chapter is locked
Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Modern REST API Development in Go
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Modal Close icon
Modal Close icon