..
This commit is contained in:
parent
abe6ba4ed6
commit
efc7072c63
2 changed files with 3 additions and 3 deletions
2
main.go
2
main.go
|
|
@ -8,7 +8,7 @@ import (
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
cfg := LoadConfig()
|
cfg := LoadConfig()
|
||||||
http.HandleFunc("/", alertReceiver)
|
http.HandleFunc("/", cfg.alertReceiver)
|
||||||
log.Printf("Server starting on http://localhost:%d", cfg.Port)
|
log.Printf("Server starting on http://localhost:%d", cfg.Port)
|
||||||
log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", cfg.Port), nil))
|
log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", cfg.Port), nil))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
func alertReceiver(w http.ResponseWriter, r *http.Request) {
|
|
||||||
cfg := LoadConfig()
|
func (cfg *Config) alertReceiver(w http.ResponseWriter, r *http.Request) {
|
||||||
if r.Method != http.MethodPost {
|
if r.Method != http.MethodPost {
|
||||||
http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)
|
http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue