backend for xcvr appview
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

add post my message endpoint

rachel-mp4 92d16b7f f31a3137

+15
+1
server/internal/handler/handler.go
··· 31 31 mux.HandleFunc("DELETE /lrc/{user}/{rkey}/ws", h.deleteChannel) 32 32 mux.HandleFunc("POST /lrc/channel", h.postChannel) 33 33 mux.HandleFunc("POST /lrc/message", h.postMessage) 34 + mux.HandleFunc("POST /lrc/mymessage", h.postMyMessage) 34 35 // xcvr handlers 35 36 mux.HandleFunc("POST /xcvr/profile", h.postProfile) 36 37 mux.HandleFunc("POST /xcvr/beep", h.beep)
+14
server/internal/handler/lrcHandlers.go
··· 100 100 } 101 101 if err != nil { 102 102 h.serverError(w, errors.New("error posting message: "+err.Error())) 103 + return 104 + } 105 + w.Write(nil) 106 + } 107 + 108 + func (h *Handler) postMyMessage(w http.ResponseWriter, r *http.Request) { 109 + pmr, err := h.parseMessageRequest(r) 110 + if err != nil { 111 + h.badRequest(w, errors.New("failed to parse message request: "+err.Error())) 112 + return 113 + } 114 + err = h.rm.PostMyMessage(r.Context(), pmr) 115 + if err != nil { 116 + h.serverError(w, errors.New("error posting message: "+err.Error())) 103 117 } 104 118 w.Write(nil) 105 119 }