taldir

Directory service to resolve wallet mailboxes by messenger addresses
Log | Files | Refs | Submodules | README | LICENSE

commit a59135486b3ddb147744d7fd679fba41dd1a927b
parent 8beaa21429a1b3f72a36b5d9059f7721b54340e9
Author: Martin Schanzenbach <mschanzenbach@posteo.de>
Date:   Sun, 17 Apr 2022 19:27:19 +0200

-remove some nonsense comments

Diffstat:
Mtaldir.go | 19-------------------
1 file changed, 0 insertions(+), 19 deletions(-)

diff --git a/taldir.go b/taldir.go @@ -41,9 +41,6 @@ type Validation struct { } -// let's declare a global Articles array -// that we can then populate in our main function -// to simulate a database var Entries []Entry var db *gorm.DB @@ -57,14 +54,11 @@ func sendEmail(recipient string, ref Validation) { recipient, } - // smtp server configuration. smtpHost := "localhost" smtpPort := "587" - // Message. message := []byte("Please click here to validate your Taldir identity: " + ref.ValidationReference) - // Sending email. err := smtp.SendMail(smtpHost+":"+smtpPort, nil, from, to, message) if err != nil { fmt.Println(err) @@ -75,9 +69,6 @@ func sendEmail(recipient string, ref Validation) { func returnSingleEntry(w http.ResponseWriter, r *http.Request){ vars := mux.Vars(r) - // Loop over all of our Articles - // if the article.Id equals the key we pass in - // return the article encoded as JSON var entry Entry var err = db.First(&entry, "identity_key = ?", vars["identity_key"]).Error if err == nil { @@ -117,9 +108,6 @@ func generateToken() string { } func addSingleEntry(w http.ResponseWriter, r *http.Request){ - // Loop over all of our Articles - // if the article.Id equals the key we pass in - // return the article encoded as JSON var entry Entry if r.Body == nil { http.Error(w, "No request body", 400) @@ -153,18 +141,11 @@ func addSingleEntry(w http.ResponseWriter, r *http.Request){ json.NewEncoder(w).Encode(entry) } - - func handleRequests() { - // creates a new instance of a mux router myRouter := mux.NewRouter().StrictSlash(true) - // replace http.HandleFunc with myRouter.HandleFunc myRouter.HandleFunc("/directory/{id}", returnSingleEntry).Methods("GET") myRouter.HandleFunc("/validation/{reference}", validateSingleEntry).Methods("POST") myRouter.HandleFunc("/directory/", addSingleEntry).Methods("POST") - // finally, instead of passing in nil, we want - // to pass in our newly created router as the second - // argument log.Fatal(http.ListenAndServe(":10000", myRouter)) }