hub: Import mux and listen to requests
parent
f790bda8f4
commit
396f9efbfb
|
@ -0,0 +1,2 @@
|
|||
# Ignore eventual build artifacts
|
||||
hub/main
|
|
@ -1,3 +1,5 @@
|
|||
module git.elis.nu/etu/websubhub/hub
|
||||
|
||||
go 1.15
|
||||
|
||||
require github.com/gorilla/mux v1.8.0
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
|
||||
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
|
20
hub/main.go
20
hub/main.go
|
@ -1,7 +1,23 @@
|
|||
package main
|
||||
|
||||
import "fmt"
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Println("Hello")
|
||||
router := mux.NewRouter()
|
||||
|
||||
router.HandleFunc("/", subscribeHandler).Methods("POST")
|
||||
|
||||
log.Fatal(http.ListenAndServe(":8080", router))
|
||||
}
|
||||
|
||||
func subscribeHandler(w http.ResponseWriter, r *http.Request) {
|
||||
fmt.Println(r)
|
||||
|
||||
fmt.Println("got request")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue