Changes for the fax branch

This commit is contained in:
2024-05-09 15:14:01 +01:00
parent 9c86b28fc0
commit ec957b1255
11 changed files with 296 additions and 81 deletions
+2 -2
View File
@@ -14,8 +14,8 @@ import (
func serverCmdAction(cmd *cobra.Command, args []string) {
http.HandleFunc("/print", server.LaunchServer)
fmt.Println("Starting server on port 8083")
log.Fatal(http.ListenAndServe(":8083", nil))
fmt.Println("Starting server on port 9099")
log.Fatal(http.ListenAndServe(":9099", nil))
}
// serverCmd represents the server command
+6 -5
View File
@@ -15,14 +15,15 @@ func printMessage(message string) {
func LaunchServer(w http.ResponseWriter, r *http.Request) {
w.Header().Add("Content-Type", "application/json")
if !authenticate(w, r) {
return
}
// TODO: solve this thing
// if !authenticate(w, r) {
// return
// }
data, _ := io.ReadAll(r.Body)
fmt.Println(string(data))
// printMessage(string(data) + "\n\n\n\n\n")
// printMessage(string(data) + "\n\n\n")
w.WriteHeader(http.StatusOK)
w.Write([]byte(`{"message": "welcome to thermics"}`))
w.Write([]byte(`{"result": "SUCCESS"}`))
}