package app

import (
	"lash"
	"lash/internal/errx"
	"lash/internal/handlers"
	"net/http"
)

func New() http.Handler {
	mux := http.NewServeMux()

	fp, err := GetFilePath()
	if err != nil {
		errx.FatalPerror(err)
	}

	share := handlers.ShareData{
		Version: lash.Version,
		FileName: fp,
	}

	file := handlers.FileData{}

	mux.HandleFunc("/", share.Handler)
	mux.HandleFunc("/api/receive-token", file.APIHandler)

	return mux
}
