func repoRoute(c *routing.Context) error {
	return c.Write(rJSON)
}
repoRoute function for handler /repo
package main
import (
	"io"
	"io/ioutil"
	"log"
	"net/http"
	"os"
	"os/exec"
	"time"
	"github.com/FINRAOS/yum-nginx-api/repojson"
	routing "github.com/go-ozzo/ozzo-routing"
	"github.com/go-ozzo/ozzo-routing/access"
	"github.com/go-ozzo/ozzo-routing/content"
	"github.com/go-ozzo/ozzo-routing/fault"
	"github.com/go-ozzo/ozzo-routing/slash"
	"github.com/h2non/filetype"
)
func crRoutine() {
	for {
		if crCtr > 0 {
			for i := 0; i < maxRetries; i++ {
				crExec := exec.Command(crBin, "--update", "--workers", createRepo, uploadDir)
				_, err := crExec.Output()
				if err != nil {
					log.Println("Unable to execute createrepo ", err)
				} else {
					rJSON, err = repojson.RepoJSON(uploadDir)
					if err != nil {
						log.Println(err)
					}
					crCtr--
					break
				}
				time.Sleep(1 * time.Second)
			}
		}
		time.Sleep(3 * time.Second)
	}
}
func uploadRoute(c *routing.Context) error {
	err := c.Request.ParseMultipartForm(maxLength)
	if err != nil {
		c.Response.WriteHeader(http.StatusInternalServerError)
		_ = c.Write("Upload Failed " + err.Error())
		return err
	}
	file, handler, err := c.Request.FormFile("file")
	if err != nil {
		c.Response.WriteHeader(http.StatusInternalServerError)
		_ = c.Write("Upload Failed " + err.Error())
		return err
	}
	defer file.Close()
	filePath := uploadDir + handler.Filename
	f, err := os.OpenFile(filePath, os.O_WRONLY|os.O_CREATE, 0644)
	if err != nil {
		c.Response.WriteHeader(http.StatusInternalServerError)
		_ = c.Write("Upload Failed " + err.Error())
		return err
	}
	defer f.Close()
	_, err = io.Copy(f, file)
	if err != nil {
		c.Response.WriteHeader(http.StatusInternalServerError)
		_ = c.Write("Upload Failed " + err.Error())
		return err
	}
	buf, _ := ioutil.ReadFile(filePath)
	if kind, err := filetype.Match(buf); err != nil || kind.MIME.Value != "application/x-rpm" {
		err := os.Remove(filePath)
		if err != nil {
			log.Println("Unable to delete " + filePath)
		}
		c.Response.WriteHeader(http.StatusUnsupportedMediaType)
		return c.Write(handler.Filename + " not RPM")
	}
	if !devMode {
		crCtr++
	}
	c.Response.WriteHeader(http.StatusAccepted)
	return c.Write("Uploaded")
}
func healthRoute(c *routing.Context) error {
	c.Response.Header().Add("Version", commitHash)
	return c.Write("OK")
}