<commit_before>package main

import (
  "fmt"
  "github.com/gorilla/mux"
  )

func main() {
  r := mux.NewRouter()
  r.HandleFunc("/", defaultHandler)
  r.HandleFunc("/leaders", leadersHandler)

  port := os.Getenv("PORT")
  if len(port) == 0 {
    port := "8080"
  }
}<commit_msg>Fleshing out the sparkle handlers<commit_after>package main

import (
	"fmt"
	"github.com/gorilla/mux"
	"log"
	"net/http"
	"time"
  "os"
)

type Request struct {
	SparkledBy string    `json:"sparkled_by"`
	Recipient  string    `json:"recipient"`
	SparkledAt time.Time `json:"sparkled_at"`
}

func defaultHandler(w http.ResponseWriter, h *http.Request) {
	fmt.Fprint(w, "Default sparkles")
}

func addSparkles(w http.ResponseWriter, h *http.Request){
  fmt.Fprint(w, "Add a sparkle")
}

func getSparkles(w http.ResponseWriter, h *http.Request){
  fmt.Fprint(w, "Get sparkles")
}

func Log(handler http.Handler) http.Handler {
	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		remoteAddr := r.RemoteAddr
		if len(remoteAddr) == 0 {
			remoteAddr = r.Header.Get("x-forwarded-for")
		}
		log.Printf("%s %s %s", r.RemoteAddr, r.Method, r.URL)
		handler.ServeHTTP(w, r)
	})
}

func main() {
	r := mux.NewRouter()
	r.HandleFunc("/", defaultHandler).Methods("GET")
  r.HandleFunc("/sparkles", addSparkles).Methods("POST")
  r.HandleFunc("/sparkles", getSparkles).Methods("GET")

	port := os.Getenv("PORT")
	if len(port) == 0 {
		port = "8080"
	}

	http.Handle("/", r)
	log.Printf("[+] Starting the sparkles app on port %s", port)
	http.ListenAndServe(":"+port, Log(http.DefaultServeMux))
}
{'fraction_non_alphanumeric': 0.1733921815889029, 'fraction_numerical': 0.0069356872635561164, 'mean_word_length': 4.343434343434343, 'pattern_counts': {'":': 1, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5137648', 'n_tokens_mistral': 633, 'n_tokens_neox': 607, 'n_words': 124}