package main
|
|
|
|
import (
|
|
"flag"
|
|
"net/http"
|
|
|
|
"git.tovijaeschke.xyz/tovi/SuddenImpactRecords/Api"
|
|
"git.tovijaeschke.xyz/tovi/SuddenImpactRecords/Database"
|
|
"git.tovijaeschke.xyz/tovi/SuddenImpactRecords/Database/Seeder"
|
|
"git.tovijaeschke.xyz/tovi/SuddenImpactRecords/Frontend"
|
|
|
|
"github.com/gorilla/mux"
|
|
)
|
|
|
|
var (
|
|
seed bool
|
|
)
|
|
|
|
func init() {
|
|
Database.Init()
|
|
|
|
flag.BoolVar(&seed, "seed", false, "Seed database for development")
|
|
|
|
flag.Parse()
|
|
}
|
|
|
|
func main() {
|
|
var (
|
|
router *mux.Router
|
|
)
|
|
|
|
if seed {
|
|
Seeder.Seed()
|
|
return
|
|
}
|
|
|
|
router = mux.NewRouter()
|
|
|
|
Api.InitApiEndpoints(router)
|
|
Frontend.InitFrontendRoutes(router)
|
|
|
|
http.ListenAndServe(":8080", router)
|
|
}
|