func (s *Service) get(w http.ResponseWriter, r *http.Request, _ mux.Params) {
	key := []byte(r.URL.String())
	value, err := s.todos.Get(key)
	if err != nil {
		http.Error(w, err.Error(), 500)
	}
	w.Header().Set("Content-Type", "application/json")
	w.Write(value)
}
get handles get requests for a daily todo item.
package main
import (
	"bytes"
	"encoding/json"
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
	"net/http/httptest"
	"os"
	"github.com/joyrexus/buckets"
	mux "github.com/julienschmidt/httprouter"
)
const verbose = false  
func main() {
	bx, err := buckets.Open(tempFilePath())
	if err != nil {
		log.Fatalf("couldn't open db: %v", err)
	}
	defer os.Remove(bx.Path())
	defer bx.Close()
	bucket, err := bx.New([]byte("todos"))
	if err != nil {
		log.Fatalf("couldn't create todos bucket: %v", err)
	}
	service := NewService(bucket)
	router := mux.New()
	router.GET("/:day", service.get)
	router.POST("/:day", service.post)
	srv := httptest.NewServer(router)
	defer srv.Close()
	posts := map[string]*Todo{
		"/mon": {Day: "mon", Task: "milk cows"},
		"/tue": {Day: "tue", Task: "fold laundry"},
		"/wed": {Day: "wed", Task: "flip burgers"},
		"/thu": {Day: "thu", Task: "join army"},
		"/fri": {Day: "fri", Task: "kill time"},
		"/sat": {Day: "sat", Task: "make merry"},
		"/sun": {Day: "sun", Task: "pray quietly"},
	}
	client := new(Client)
	for path, todo := range posts {
		url := srv.URL + path
		if err := client.post(url, todo); err != nil {
			fmt.Printf("client post error: %v", err)
		}
	}
	for path := range posts {
		url := srv.URL + path
		task, err := client.get(url)
		if err != nil {
			fmt.Printf("client get error: %v", err)
		}
		fmt.Printf("%s: %s\n", path, task)
	}
}
type Todo struct {
	Task string
	Day  string
}
func (todo *Todo) Encode() (*bytes.Buffer, error) {
	b, err := json.Marshal(todo)
	if err != nil {
		return &bytes.Buffer{}, err
	}
	return bytes.NewBuffer(b), nil
}
func NewService(bk *buckets.Bucket) *Service {
	return &Service{bk}
}
type Service struct {
	todos *buckets.Bucket
}