We need to collect data from an external source to have any value in this app. We'll query the classify2 API to fetch real reference information based on the user's search criteria.
- [Instructor] Hi and welcome back.…In the previous video, we started building a search UI…using asynchronous HTTP request to update our interface…based on data returned from the server.…We want to find real books based on the user's search query.…In this video, we'll replace our dummy data…with real search results based on input from the user.…We'll start by updating our backend…to fetch results from the classify2 API.…Next we'll decode the XML response data…into our search result struct.…Finally, we'll encode the search results into JSON…to return to the front-end.…
For this feature, we'll use a book classification library…called classify2.…The Classify API has a single endpoint,…which we'll use to perform our search…and eventually get the classification information…for individual books.…In our main.go file,…let's create a new function called search,…which takes in a search query string…and returns a list of search results and an error.…Let's define two variables at the top of this function,…one for the response and one for any errors we encounter.…
Go is on the rise. This open-source programming language (created by Google!) comes with a strong and accessible standard library, and provides a growing ecosystem of tools, libraries, and frameworks that can help you build web applications fast. Go for Web Development gets you started with the language, opening with the classic "Hello world" exercise and culminating in a web application with a strongly designed database back end, useful middleware, UI with an intelligent search function, multi-user authentication, and more.
First, learn how to build a web server with Go's extensive standard library. Explore the concepts behind a single-page web application and learn how to create a dynamic user interface, manipulate a database, and use powerful encryption algorithms to implement an authentication system. Next, you'll incorporate more functionality by calling out to external libraries from the database. Finally, it all comes together into an optimized package you can deploy into the wild with Heroku.
- Creating a route in Go
- Using templates
- Building database connections
- Collecting data
- Using web middleware
- Using the Ace template engine
- Integrating HTTP routers like gorilla/mux
- Authenticating users
- Optimizing a Go codebase