June 2017
Beginner
1091 pages
22h 9m
English
In Chapter 11, Writing Networked Services, we saw that Go offers first-class APIs to build client and server programs using HTTP. The net/http/httptest sub-package, part of the Go standard library, facilitates the testing automation of both HTTP server and client code, as discussed in this section.
To explore this space, we will implement a simple API service that exposes the vector operations (covered in earlier sections) as HTTP endpoints. For instance, the following source snippet partially shows the methods that make up the server (for a complete listing, see https://github.com/vladimirvivien/learning-go/ch12/service/serv.go):
package main import ( "encoding/json" "fmt" "net/http" "github.com/vladimirvivien/learning-go/ch12/vector" ...
Read now
Unlock full access