package view

import (
	"fmt"
	"net/http"
)

func VersionRead(version string) func(http.ResponseWriter, *http.Request) {
	return 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)
	}
}