In this book we’re going to work through the start-to-finish build of an application called Greenlight — a JSON API for retrieving and managing information about movies. You can think of the core functionality as being a bit like the Open Movie Database API.
Ultimately, our Greenlight API will support the following endpoints and actions:
|GET||/v1/healthcheck||Show application health and version information|
|GET||/v1/movies||Show the details of all movies|
|POST||/v1/movies||Create a new movie|
|GET||/v1/movies/:id||Show the details of a specific movie|
|PATCH||/v1/movies/:id||Update the details of a specific movie|
|DELETE||/v1/movies/:id||Delete a specific movie|
|POST||/v1/users||Register a new user|
|PUT||/v1/users/activated||Activate a specific user|
|PUT||/v1/users/password||Update the password for a specific user|
|POST||/v1/tokens/authentication||Generate a new authentication token|
|POST||/v1/tokens/password-reset||Generate a new password-reset token|
|GET||/debug/vars||Display application metrics|
To give you an idea of what the API will look like from a client’s point of view, by the end of this book the
GET /v1/movies/:id endpoint will return a response similar this:
Behind the scenes, we’ll use PostgreSQL as the database for persistently storing all the data. And at the end of the book, we’ll deploy the finished API to a Linux server running on Digital Ocean.
In this book, code blocks are shown with a silver background like the snippet below. If the code block is particularly long, parts that aren’t relevant may be replaced with an ellipsis. To make it easy to follow along, most code blocks also have a title bar at the top indicating the name of the file that we’re working on.
Terminal (command line) instructions are shown with a black background and generally start with a dollar symbol. These commands should work on any Unix-based operating system, including macOS and Linux. Sample output is shown in silver beneath the command, like so:
If you’re using Windows, you should replace these commands with the DOS equivalent or carry out the action via the normal Windows GUI.
Some chapters in this book end with an additional information section. These sections contain information that isn’t relevant to our application build, but is still important (or sometimes, just interesting) to know about.
About the author
Hey, I’m Alex Edwards, a full-stack web developer and author. I live near Innsbruck, Austria.
I’ve been working with Go for over 8 years, building production applications for myself and commercial clients, and helping people all around the world improve their Go skills.
You can see more of my writing on my blog (where I publish detailed tutorials), some of my open-source work on GitHub, and you can also follow me on Instagram and Twitter.
Copyright and disclaimer
Let’s Go Further. Copyright © 2022 Alex Edwards.
Last updated 2022-09-19 12:09:59 UTC. Version 1.19.1.
The Go gopher was designed by Renee French and is used under the Creative Commons 3.0 Attributions license. Cover gopher adapted from vectors by Egon Elbre.
The information provided within this book is for general informational purposes only. While the author and publisher have made every effort to ensure that the accuracy of the information within this book was correct at time of publication there are no representations or warranties, express or implied, about the completeness, accuracy, reliability, suitability or availability with respect to the information, products, services, or related graphics contained in this book for any purpose. Any use of this information is at your own risk.