gorest/main.go
2023-05-05 17:13:50 +02:00

25 lines
427 B
Go

package main
import (
"fmt";
"log";
"net/http";
"github.com/gorilla/mux";
)
func main() {
router := registerEndpoints()
fmt.Println("Starting server at :8000")
log.Fatal(http.ListenAndServe(":8000", router))
}
func registerEndpoints() *mux.Router {
router := mux.NewRouter().StrictSlash(true)
router.HandleFunc("/", ShowMessage).Methods("GET")
router.HandleFunc("/", SaveValue).Methods("POST")
return router
}