Book Image

Mastering Go Web Services

By : Nathan Kozyra
Book Image

Mastering Go Web Services

By: Nathan Kozyra

Overview of this book

<p>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.</p> <p>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.</p>
Table of Contents (18 chapters)
Mastering Go Web Services
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Implementing alternative formats


When looking at the world of API formats, you know by now that there are two big players: XML and JSON. As human-readable formats, these two have owned the format world for more than a decade.

As is often the case, developers and technologists rarely settle happily for something for long. XML was number one for a very long time before the computational complexity of encoding and decoding as well as the verbosity of schema pushed many developers towards JSON.

JSON is not without its faults either. It's not all that readable by humans without some explicit spacing, which then increases the size of the document excessively. It doesn't handle commenting by default either.

There are a number of alternative formats that are sitting on the sideline. YAML, which stands for YAML Ain't Markup Language, is a whitespace-delimited format that uses indentation to make it extremely readable for humans. An example document would look something like this:

---
api:
  name: Social...