type UserStore interface {
CheckEmailExists(email string) (bool, error)
StoreUser(newUser User) error
SendEmail(to User, body string, subject string) error
func NewRegistrationHandler(userStore UserStore, emailer Emailer) http.HandlerFunc {
return func(writer http.ResponseWriter, request *http.Request) {
// extract out the user from the request body (handle error)
// check user exists (handle duplicates, errors)
// store user (handle errors)
// compose and send confirmation email (handle error)
// if we got this far, return 2xx response