<commit_before>package handlers

import (
	"encoding/json"
	"github.com/didip/mcrouter-hub/libhttp"
	"github.com/didip/mcrouter-hub/payloads"
	"github.com/didip/mcrouter-hub/storage"
	"github.com/gorilla/context"
	"io/ioutil"
	"net/http"
)

func CentralGetRoot(w http.ResponseWriter, r *http.Request) {
	readOnly := context.Get(r, "readOnly").(bool)
	if readOnly {
		w.Write([]byte(`{
    paths: {
        GET: [
            "/configs"
        ]
    }
}`))

	} else {
		w.Write([]byte(`{
    paths: {
        GET: [
            "/configs"
        ],
        POST: [
            "/configs"
        ]
    }
}`))<commit_msg>add /stats to root.<commit_after>package handlers

import (
	"encoding/json"
	"github.com/didip/mcrouter-hub/libhttp"
	"github.com/didip/mcrouter-hub/payloads"
	"github.com/didip/mcrouter-hub/storage"
	"github.com/gorilla/context"
	"io/ioutil"
	"net/http"
)

func CentralGetRoot(w http.ResponseWriter, r *http.Request) {
	readOnly := context.Get(r, "readOnly").(bool)
	if readOnly {
		w.Write([]byte(`{
    paths: {
        GET: [
            "/configs",
            "/stats"
        ]
    }
}`))

	} else {
		w.Write([]byte(`{
    paths: {
        GET: [
            "/configs",
            "/stats"
        ],
        POST: [
            "/configs",
            "/stats"
        ]
    }
}`))
{'fraction_non_alphanumeric': 0.1750380517503805, 'fraction_numerical': 0.0, 'mean_word_length': 1.9886363636363635, 'pattern_counts': {'":': 0, '<': 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': '3488883', 'n_tokens_mistral': 500, 'n_tokens_neox': 499, 'n_words': 68}