Building Web Services

The core subject of this chapter is working with HTTP using the net/http package—remember that all web services require a web server in order to operate. Additionally, in this chapter, we are going to convert the phone book application into a web application that accepts HTTP connections and create a command-line client to work with it. Lastly, we'll illustrate how to create an FTP (File Transfer Protocol) server and how to export metrics from Go applications to Prometheus and work with the runtime/metrics package to get implementation-defined metrics exported by the Go runtime.

In more detail, this chapter covers:

  • The net/http package
  • Creating a web server
  • Updating the phone book application
  • Exposing metrics to Prometheus ...

Get Mastering Go - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.