Building Distributed Applications in Gin
eBook - ePub

Building Distributed Applications in Gin

Mohamed Labouardy

Partager le livre
  1. 482 pages
  2. English
  3. ePUB (adapté aux mobiles)
  4. Disponible sur iOS et Android
eBook - ePub

Building Distributed Applications in Gin

Mohamed Labouardy

DĂ©tails du livre
Aperçu du livre
Table des matiĂšres
Citations

À propos de ce livre

An effective guide to learning how to build a large-scale distributed application using the wide range of functionalities in GinKey Features‱ Explore the commonly used functionalities of Gin to build web applications‱ Become well-versed with rendering HTML templates with the Gin engine‱ Solve commonly occurring challenges such as scaling, caching, and deploymentBook DescriptionGin is a high-performance HTTP web framework used to build web applications and microservices in Go. This book is designed to teach you the ins and outs of the Gin framework with the help of practical examples. You'll start by exploring the basics of the Gin framework, before progressing to build a real-world RESTful API. Along the way, you'll learn how to write custom middleware and understand the routing mechanism, as well as how to bind user data and validate incoming HTTP requests. The book also demonstrates how to store and retrieve data at scale with a NoSQL database such as MongoDB, and how to implement a caching layer with Redis. Next, you'll understand how to secure and test your API endpoints with authentication protocols such as OAuth 2 and JWT. Later chapters will guide you through rendering HTML templates on the server-side and building a frontend application with the React web framework to consume API responses. Finally, you'll deploy your application on Amazon Web Services (AWS) and learn how to automate the deployment process with a continuous integration/continuous delivery (CI/CD) pipeline. By the end of this Gin book, you will be able to design, build, and deploy a production-ready distributed application from scratch using the Gin framework.What you will learn‱ Build a production-ready REST API with the Gin framework‱ Scale web applications with event-driven architecture‱ Use NoSQL databases for data persistence‱ Set up authentication middleware with JWT and Auth0‱ Deploy a Gin-based RESTful API on AWS with Docker and Kubernetes‱ Implement a CI/CD workflow for Gin web appsWho this book is forThis book is for Go developers who are comfortable with the Go language and seeking to learn REST API design and development with the Gin framework. Beginner-level knowledge of the Go programming language is required to make the most of this book.

Foire aux questions

Comment puis-je résilier mon abonnement ?
Il vous suffit de vous rendre dans la section compte dans paramĂštres et de cliquer sur « RĂ©silier l’abonnement ». C’est aussi simple que cela ! Une fois que vous aurez rĂ©siliĂ© votre abonnement, il restera actif pour le reste de la pĂ©riode pour laquelle vous avez payĂ©. DĂ©couvrez-en plus ici.
Puis-je / comment puis-je télécharger des livres ?
Pour le moment, tous nos livres en format ePub adaptĂ©s aux mobiles peuvent ĂȘtre tĂ©lĂ©chargĂ©s via l’application. La plupart de nos PDF sont Ă©galement disponibles en tĂ©lĂ©chargement et les autres seront tĂ©lĂ©chargeables trĂšs prochainement. DĂ©couvrez-en plus ici.
Quelle est la différence entre les formules tarifaires ?
Les deux abonnements vous donnent un accĂšs complet Ă  la bibliothĂšque et Ă  toutes les fonctionnalitĂ©s de Perlego. Les seules diffĂ©rences sont les tarifs ainsi que la pĂ©riode d’abonnement : avec l’abonnement annuel, vous Ă©conomiserez environ 30 % par rapport Ă  12 mois d’abonnement mensuel.
Qu’est-ce que Perlego ?
Nous sommes un service d’abonnement Ă  des ouvrages universitaires en ligne, oĂč vous pouvez accĂ©der Ă  toute une bibliothĂšque pour un prix infĂ©rieur Ă  celui d’un seul livre par mois. Avec plus d’un million de livres sur plus de 1 000 sujets, nous avons ce qu’il vous faut ! DĂ©couvrez-en plus ici.
Prenez-vous en charge la synthÚse vocale ?
Recherchez le symbole Écouter sur votre prochain livre pour voir si vous pouvez l’écouter. L’outil Écouter lit le texte Ă  haute voix pour vous, en surlignant le passage qui est en cours de lecture. Vous pouvez le mettre sur pause, l’accĂ©lĂ©rer ou le ralentir. DĂ©couvrez-en plus ici.
Est-ce que Building Distributed Applications in Gin est un PDF/ePUB en ligne ?
Oui, vous pouvez accĂ©der Ă  Building Distributed Applications in Gin par Mohamed Labouardy en format PDF et/ou ePUB ainsi qu’à d’autres livres populaires dans Computer Science et Web Programming. Nous disposons de plus d’un million d’ouvrages Ă  dĂ©couvrir dans notre catalogue.

Informations

Année
2021
ISBN
9781801079556
Édition
1
Sous-sujet
Web Programming

Section 1: Inside the Gin Framework

In this part, we will cover the hype and performance benefits of the Gin Framework. This part will also cover how to write a simple Gin-based application. As such, it includes the following chapter:
  • Chapter 1, Getting Started with Gin

Chapter 1: Getting Started with Gin

This chapter will give you a foundational understanding of what the Gin framework is, how it works, and its features. We'll also supply guidelines for setting up the Go runtime and development environment. Moreover, we'll discuss the advantages of using Gin as a web framework for building distributed applications. We will finish this chapter by learning to write our first Gin-based web application.
In this chapter, we will cover the following topics:
  • What is Gin?
  • Go runtime and integrated development environment (IDE)
  • Go modules and dependency management
  • Writing a Gin web application
By the end of this chapter, you will be able to build a basic HTTP server with the Gin web framework.

Technical requirements

To follow along with this chapter, you will need the following:
  • Some programming experience. The code in this chapter is pretty simple, but it helps to know something about Go.
  • A tool to edit your code with. Any text editor you have will work fine. Most text editors have good support for Go. The most popular are Visual Studio Code (VSCode) (free), GoLand (paid), and Vim (free).
  • A command terminal. Go works well using any Terminal on Linux and Mac, and on PowerShell or CMD in Windows.
The code bundle for this chapter is hosted on GitHub at https://github.com/PacktPublishing/Building-Distributed-Applications-in-Gin/tree/main/chapter01.

What is Gin?

Before deep diving into the Gin web framework, we need to understand why Go is a top choice when it comes to building scalable and distributed applications.
Go (also referred to as Golang) is an open source programming language, developed by Robert Griesemer, Rob Pike, and Ken Thompson within Google in 2007. It is a compiled, statically typed language designed to enable users to easily write reliable, scalable, and highly efficient applications. The key features of Go are as follows:
  • Simple and consistent: Go has a rich set of library packages with powerful standard libraries for testing, error management, and concurrency.
  • Fast and scalable: Go is a general-purpose programming language developed for the multi-core reality of today's computers. It has built-in concurrency with Goroutines and channels. Goroutines provide lightweight, threaded execution. Declaring a Goroutine is as simple as adding the go keyword before a function.
  • Efficient: Go provides efficient execution and compilation. Go is also statically linked, which means that the compiler invokes a linker in the last step that resolves all library references. This means we would get one binary executable after compiling a Go program with no external dependencies. Moreover, it offers efficient memory utilization with a built-in garbage collector (Go exhibits many similarities with low-level programming languages such as C or C++).
  • Community and support: Go is backed by Google and has an ever growing ecosystem and numerous contributors to the language on GitHub. Moreover, many online resources (tutorials, videos, and books) are available for getting started with Go.
Go has become hugely popular among enterprises and the open source community. Based on the StackOverflow Developer Survey 2020 (https://insights.stackoverflow.com/survey/2020), Go is in the top 5 of the most loved programming languages:
Figure 1.1 – Most loved programming languages according to the StackOverflow Survey 2020
Figure 1.1 – Most loved programming languages according to the StackOverflow Survey 2020
Golang is known to be the number one choice when it comes to b...

Table des matiĂšres