site and webhooks packages stubbed
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
package etsy
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func NewWebhookHandler() http.Handler {
|
||||
mux := http.NewServeMux()
|
||||
|
||||
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "text/plain")
|
||||
w.Write([]byte(fmt.Sprintf("received etsy webhook call: %s %s\n", r.Method, r.URL)))
|
||||
})
|
||||
|
||||
return mux
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package tiktok
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func NewWebhookHandler() http.Handler {
|
||||
mux := http.NewServeMux()
|
||||
|
||||
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "text/plain")
|
||||
w.Write([]byte(fmt.Sprintf("received tiktok webhook call: %s %s\n", r.Method, r.URL)))
|
||||
})
|
||||
|
||||
return mux
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package webhooks
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"ruben/inventory2/internal/webhooks/etsy"
|
||||
"ruben/inventory2/internal/webhooks/tiktok"
|
||||
"ruben/inventory2/internal/webhooks/wix"
|
||||
)
|
||||
|
||||
func New() http.Handler {
|
||||
wh := http.NewServeMux()
|
||||
|
||||
wh.Handle("/etsy/", http.StripPrefix("/etsy", etsy.NewWebhookHandler()))
|
||||
wh.Handle("/tiktok/", http.StripPrefix("/tiktok", tiktok.NewWebhookHandler()))
|
||||
wh.Handle("/wix/", http.StripPrefix("/wix", wix.NewWebhookHandler()))
|
||||
|
||||
return wh
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package wix
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func NewWebhookHandler() http.Handler {
|
||||
mux := http.NewServeMux()
|
||||
|
||||
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "text/plain")
|
||||
w.Write([]byte(fmt.Sprintf("received wix webhook call: %s %s\n", r.Method, r.URL)))
|
||||
})
|
||||
|
||||
return mux
|
||||
}
|
||||
Reference in New Issue
Block a user