hub: Import mux and listen to requests

master
Elis Hirwing 2020-11-20 23:18:59 +01:00
parent f790bda8f4
commit 396f9efbfb
Signed by: etu
GPG Key ID: D57EFA625C9A925F
4 changed files with 24 additions and 2 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# Ignore eventual build artifacts
hub/main

View File

@ -1,3 +1,5 @@
module git.elis.nu/etu/websubhub/hub
go 1.15
require github.com/gorilla/mux v1.8.0

2
hub/go.sum Normal file
View File

@ -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=

View File

@ -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")
}