knowyt/server/handler/internal.go

26 lines
441 B
Go
Raw Normal View History

2021-07-28 20:21:14 +00:00
package handler
import (
"fmt"
"net/http"
"os"
"time"
)
2021-07-29 16:42:52 +00:00
type HttpHandler func(http.ResponseWriter, *http.Request)
2021-07-28 20:21:14 +00:00
func Exit(_ http.ResponseWriter, _ *http.Request) {
os.Exit(0)
}
2021-07-29 16:42:52 +00:00
func CreateVersionHandler() HttpHandler {
2021-07-28 20:21:14 +00:00
startTime := time.Now().Unix()
return func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "%d\n", startTime)
}
}
func IsLoggedIn(w http.ResponseWriter, _ *http.Request) {
fmt.Fprintf(w, "ok")
}