Challenge 02 - Creating a Simple HTTP Server in Go Image Challenge 02 - Creating a Simple HTTP Server in Go

In this challenge, you are going to be extending the application you built in the previous challenge and exposing the hardware utilization stats you collected through a HTTP endpoint.

Challenge

You will extend the application developed in the first challenge so that these statistics can be queried via a http request.

This application will run indefinitely on a machine and expose information on given port and an endpoint such that when you hit http://localhost:9000/stats it will fetch and display the stats for that machine in JSON format.

Acceptance Criteria

In order to successfully complete this challenge, your project will have to:

  • Expose the hardware utilization stats collected from your machine on http://localhost:9000/stats in JSON format

Key Concepts

Through completing this challenge:

  • You will gain an understanding of how to write a simple HTTP server in Go
  • You will learn about how to marshal and unmarshal information into structs using the encoding/json standard library package in Go.

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!

Helpful Tutorials

The following tutorials should help you to complete this challenge:

Conclusion

Congratulations! You have successfully completed the second TutorialEdge Go challenge!

Elliot Forbes

Elliot Forbes
Twitter: @Elliot_f

Hey, I'm Elliot and I've been working on TutorialEdge for the last 4 years! If my work has helped you in any way, shape, or form then please consider supporting my work.

become a patron Buy Me A Coffee