This commit is contained in:
Malachy Byrne 2022-10-24 21:29:58 +01:00
commit efd87e6a3d
Signed by: malmal200
GPG Key ID: EC21443030A655D9
3 changed files with 34 additions and 0 deletions

7
backend/go.mod Normal file
View File

@ -0,0 +1,7 @@
module games.dcu.ie/hvz/v2
go 1.19
require (
"github.com/gorilla/mux" v1.8.0
)

2
backend/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=

25
backend/main.go Normal file
View File

@ -0,0 +1,25 @@
package main
import (
"fmt"
"log"
"net/http"
"github.com/gorilla/mux"
)
func handleRequests() {
myRouter := mux.NewRouter().StrictSlash(true)
myRouter.HandleFunc("/", homePage)
log.Fatal(http.ListenAndServe(":8000", myRouter))
}
func homePage(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Welcome to the Homepage")
fmt.Println("endpoint hit: homepage")
}
func main() {
handleRequests()
}