WaitGroups are without a doubt some of the best features of the language. They enable us to more easily write highly concurrent applications that are vastly more efficient and quicker than their synchronous counterparts.
In this challenge, we will be creating a REST API that does the job of hitting a number of API endpoints and returning an aggregated response back to the requester. In order to successfully complete this, you will have to leverage
goroutines within your endpoint function and ensure that every request is completed before returning a response to the requester.
In order to successfully complete this challenge, your project will have to:
Create a simple REST API in Go that calls out to the PokeAPI and orders the height of these 5 pokemon:
The PokeAPI documentation can be found here: PokeAPI
By completing this challenge:
- You will gain an insight into the basics of
goroutinesand how you can handle premature termination of your functions using
- You will learn how to request and parse JSON from an external HTTP API
Completing the Challenge
In order to complete the challenge, fork the elliotforbes/go-challenges repository into your own GitHub account.
Next, create a directory within that repo for each of the challenges you attempt! This will give you a super handy repo that will contain excellent references for your own future Go projects!
Congratulations! You have successfully completed the 4th TutorialEdge Go Challenge!