Files
2022-01-05 15:18:26 -05:00

16 lines
309 B
Go

package main
import (
"net/http"
"encoding/json"
)
func HandleJsonRequest(writer http.ResponseWriter, request *http.Request) {
writer.Header().Set("Content-Type", "application/json")
json.NewEncoder(writer).Encode(Products)
}
func init() {
http.HandleFunc("/json", HandleJsonRequest)
}