Book Image

Learning Go Web Development

By : Nathan Kozyra
Book Image

Learning Go Web Development

By: Nathan Kozyra

Overview of this book

<p>Go is an open source programming language that makes it easy to build simple, reliable, and efficient software. It is a statically typed language with syntax loosely derived from that of C, adding garbage collection, type safety, some dynamic-typing capabilities, additional built-in types such as variable-length arrays and key-value maps, and a large standard library.</p> <p>Learning Go Web Development is a start-to-finish walkthrough of the topics most critical to anyone building a new web application. Whether it’s keeping your application secure, connecting to your database, enabling token-based authentication, or utilizing logic-less templates, this book has you covered. You’ll begin by learning about routing requests and implementing SSL. Moving on, you’ll get to know about practices to keep users’ data safe. By the end of the book, you will be able to build robust, secure, and fully-featured applications for the web.</p>
Table of Contents (17 chapters)
Learning Go Web Development
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Creating our first API endpoint


Given that we want to access data from the client-side as well as from server to server, we'll need to start making some of that accessible via an API.

The most reasonable thing for us to do is a simple read, since we don't yet have methods to create data outside of direct SQL queries. We did that at the beginning of the chapter with our APIPage method, routed through a /api/pages/{UUID} endpoint.

This is great for GET requests, where we're not manipulating data, but if we need to create or modify data, we'll need to utilize other HTTP verbs and REST methods. To do this effectively, it's time to investigate some authentication and security in our API.