26 lines
446 B
Go
26 lines
446 B
Go
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()
|
|
}
|