Changes for the fax branch
This commit is contained in:
+2
-2
@@ -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
|
||||
|
||||
@@ -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"}`))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user