package view

import (
	"fmt"
	"net/http"
)

func VersionRead(version string) http.Handler {
	return http.HandlerFunc(
		func(w http.ResponseWriter, r *http.Request) {
			if version == "" {
				http.Error(w, "This build has no version information", http.StatusNotFound)
				return
			}

			fmt.Fprintln(w, version)
		},
	)
}