package server

import (
	"encoding/json"
	"fmt"
	"net/http"
)

func (server *Server) jsonDumper(w http.ResponseWriter, r *http.Request) {
	json, err := json.Marshal(server)
	if err != nil {
		fmt.Println("JSON Marshaling error:", err)
		w.WriteHeader(http.StatusInternalServerError)
		w.Write([]byte("This is my Website"))
	}
	w.Header().Set("Access-Control-Allow-Origin", "*")
	w.Header().Set("Content-Type", "application/json")
	w.WriteHeader(http.StatusOK)
	w.Write(json)
}
