You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
736 B

package main
import (
"embed"
"io/fs"
"log"
"net/http"
"git.tovijaeschke.xyz/tovi/SuddenImpactRecords/Api"
"git.tovijaeschke.xyz/tovi/SuddenImpactRecords/Database"
"github.com/gorilla/mux"
)
//go:embed Frontend/vue/dist
var frontend embed.FS
type spaHandler struct {
staticFS embed.FS
staticPath string
indexPath string
}
func main() {
var (
router *mux.Router
stripped fs.FS
frontendFS http.Handler
err error
)
Database.Init()
router = Api.InitApiEndpoints()
stripped, err = fs.Sub(frontend, "Frontend/vue/dist")
if err != nil {
log.Fatalln(err)
}
frontendFS = http.FileServer(http.FS(stripped))
router.PathPrefix("/").Handler(frontendFS)
http.ListenAndServe(":8080", router)
}