dorfylegends/main.go

42 lines
1.3 KiB
Go
Raw Normal View History

2022-04-09 12:01:04 +03:00
package main
import (
"fmt"
2022-04-09 19:37:44 +03:00
"legendsbrowser/model"
"legendsbrowser/server"
2022-04-09 12:01:04 +03:00
"net/http"
"github.com/gorilla/mux"
)
2022-04-09 19:37:44 +03:00
var world model.World
2022-04-09 12:01:04 +03:00
func main() {
fmt.Println("Hallo Welt!")
2022-04-09 19:37:44 +03:00
world.Load("region1-00152-01-01-legends.xml")
world.Process()
2022-04-09 12:01:04 +03:00
2022-04-09 19:37:44 +03:00
model.ListOtherElements(&world.HistoricalEvents)
// listOtherElements(&world.HistoricalFigures)
2022-04-09 12:01:04 +03:00
router := mux.NewRouter().StrictSlash(true)
2022-04-09 19:37:44 +03:00
server.RegisterResource(router, "region", world.RegionMap)
server.RegisterResource(router, "undergroundRegion", world.UndergroundRegionMap)
server.RegisterResource(router, "landmass", world.LandmassMap)
server.RegisterResource(router, "site", world.SiteMap)
server.RegisterResource(router, "worldConstruction", world.WorldConstructionMap)
server.RegisterResource(router, "artifact", world.ArtifactMap)
server.RegisterResource(router, "hf", world.HistoricalFigureMap)
server.RegisterResource(router, "collection", world.HistoricalEventCollectionMap)
server.RegisterResource(router, "entity", world.EntityMap)
server.RegisterResource(router, "event", world.HistoricalEventMap)
spa := server.SpaHandler{StaticPath: "frontend/dist/legendsbrowser", IndexPath: "index.html"}
router.PathPrefix("/").Handler(spa)
fmt.Println("Serving at :8080")
http.ListenAndServe(":8080", router)
2022-04-09 12:01:04 +03:00
}