<commit_before>/*
	Example REST server

	When run can be opened in a webbrowser:
	http://localhost:3000/wd/ for index, showing all entries as logic of the Index function specifies
	http://localhost:3000/wd/We get full string for index We (other indices from map also possible)
*/
package main

import (
	"fmt"
	"http"
	"log"
	"github.com/Kissaki/rest.go"
)

type Weekdays struct {
	wd map[string]string
}
func (wd *Weekdays) Index(resp http.ResponseWriter) {
	for i, v := range wd.wd {
		fmt.Fprintf(resp, "%s: %s<br/>\n", i, v)
	}
}
func (wd *Weekdays) Find(resp http.ResponseWriter, id string) {
	if full, ok := wd.wd[id]; ok {
		fmt.Fprintf(resp, full)
	}
}

func main() {
	serve()
}

func serve() {
	log.Println("Starting Server")
	address := "127.0.0.1:3000"
	
	var wd = new(Weekdays)
	wd.wd = map[string]string{
			"Mo":"Monday",
			"Tu":"Tuesday",
			"We": "Wednesday",
			"Th": "Thursday",
			"Fr": "Friday",
			"Sa": "Saturday",
			"Su": "Sunday",
			
		}
	rest.Resource("wd", wd)<commit_msg>move constant map up in separate, global var<commit_after>/*
	Example REST server

	When run can be opened in a webbrowser:
	http://localhost:3000/wd/ for index, showing all entries as logic of the Index function specifies
	http://localhost:3000/wd/We get full string for index We (other indices from map also possible)
*/
package main

import (
	"fmt"
	"http"
	"log"
	"github.com/Kissaki/rest.go"
)

var wdmap = map[string]string{
			"Mo":"Monday",
			"Tu":"Tuesday",
			"We": "Wednesday",
			"Th": "Thursday",
			"Fr": "Friday",
			"Sa": "Saturday",
			"Su": "Sunday",
			
		}

type Weekdays struct {
	wd map[string]string
}
func (wd *Weekdays) Index(resp http.ResponseWriter) {
	for i, v := range wd.wd {
		fmt.Fprintf(resp, "%s: %s<br/>\n", i, v)
	}
}
func (wd *Weekdays) Find(resp http.ResponseWriter, id string) {
	if full, ok := wd.wd[id]; ok {
		fmt.Fprintf(resp, full)
	}
}

func main() {
	log.Println("Starting Server")
	address := "127.0.0.1:3000"
	
	var wd = new(Weekdays)
	wd.wd = wdmap
	rest.Resource("wd", wd)
{'fraction_non_alphanumeric': 0.16691358024691358, 'fraction_numerical': 0.017777777777777778, 'mean_word_length': 3.689814814814815, 'pattern_counts': {'":': 14, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '2463083', 'n_tokens_mistral': 861, 'n_tokens_neox': 761, 'n_words': 220}