In this chapter, we will discuss routing of the application. For creating an API, the first step is to define routes. So, to define routes, we need to figure out available constructs in Go. We begin with the basic internal routing mechanism in Go. Then, we see how to create a custom Multiplexer. Since ServeMux's capabilities are very limited, we will explore a few other frameworks built to serve this purpose. This chapter also includes creating routes using third-party libraries such as httprouter and Gorilla Mux. We are going to build a URL-shortening API throughout this book. In this chapter, we define routes for the API. Then, we discuss topics like SQL injection of an URL. A web framework allows the developer to create a route as the first step and then attach handlers to it. Those handlers hold the business logic of the application...
United States
United Kingdom
India
Germany
France
Canada
Russia
Spain
Brazil
Australia
Argentina
Austria
Belgium
Bulgaria
Chile
Colombia
Cyprus
Czechia
Denmark
Ecuador
Egypt
Estonia
Finland
Greece
Hungary
Indonesia
Ireland
Italy
Japan
Latvia
Lithuania
Luxembourg
Malaysia
Malta
Mexico
Netherlands
New Zealand
Norway
Philippines
Poland
Portugal
Romania
Singapore
Slovakia
Slovenia
South Africa
South Korea
Sweden
Switzerland
Taiwan
Thailand
Turkey
Ukraine