init
This commit is contained in:
commit
efd87e6a3d
7
backend/go.mod
Normal file
7
backend/go.mod
Normal 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
2
backend/go.sum
Normal 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
25
backend/main.go
Normal 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()
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user