<commit_before>package main

import (
	"encoding/json"
	"github.com/gorilla/mux"
	"github.com/jpibarra1130/simple-api-go/controllers"
	"log"
	"net/http"
)

func main() {
	r := mux.NewRouter()
	r.HandleFunc("/posts", PostsHandler).Methods("GET")

	http.Handle("/", r)

	log.Println("Server started. Listening...")
	http.ListenAndServe(":3000", nil)
}

func PostsHandler(w http.ResponseWriter, r *http.Request) {
	out, err := json.Marshal(controllers.GetPosts())

	if err != nil {
		log.Fatal(err)
		w.Write([]byte("Something bad has happened."))
		return
	}

	log.Printf("Post: %v", string(out))

	w.Write([]byte(out))
}<commit_msg>Added handler for registering users.<commit_after>package main

import (
	"encoding/json"
	"github.com/gorilla/mux"
	"github.com/jpibarra1130/simple-api-go/controllers"
	"log"
	"net/http"
	"strconv"
)

func main() {
	r := mux.NewRouter()
	r.HandleFunc("/posts", PostsHandler).Methods("GET")
	r.HandleFunc("/user/register", RegisterHandler).Methods("POST")

	http.Handle("/", r)

	log.Println("Server started. Listening...")
	http.ListenAndServe(":3000", nil)
}

func PostsHandler(w http.ResponseWriter, r *http.Request) {
	out, err := json.Marshal(controllers.GetPosts())

	if err != nil {
		log.Fatal(err)
		w.Write([]byte("Something bad has happened."))
		return
	}

	log.Printf("Post: %v", string(out))

	w.Write([]byte(out))
}

func RegisterHandler(w http.ResponseWriter, r *http.Request) {
	status := controllers.RegisterUser(r.FormValue("email"), r.FormValue("password"))

	w.Write([]byte("{ status : \"" + strconv.FormatBool(status) + "\" }"))
}
{'fraction_non_alphanumeric': 0.19267214150347442, 'fraction_numerical': 0.01010739102969046, 'mean_word_length': 4.781021897810219, 'pattern_counts': {'":': 2, '<': 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': '1612026', 'n_tokens_mistral': 615, 'n_tokens_neox': 576, 'n_words': 102}