mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-16 08:55:31 +01:00
Initial commit
This commit is contained in:
25
launcher_server.go
Normal file
25
launcher_server.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/julienschmidt/httprouter"
|
||||
)
|
||||
|
||||
func g6Index(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
|
||||
http.ServeFile(w, r, "www/g6_launcher/index.html")
|
||||
|
||||
}
|
||||
|
||||
// serveLauncherHTML is responsible for serving the launcher HTML and (HACK) serverlist.xml.
|
||||
func serveLauncherHTML(listenAddr string) {
|
||||
// Manually route the folder root to index.html? Is there a better way to do this?
|
||||
router := httprouter.New()
|
||||
router.GET("/g6_launcher/", g6Index)
|
||||
|
||||
static := httprouter.New()
|
||||
static.ServeFiles("/*filepath", http.Dir("www"))
|
||||
router.NotFound = static
|
||||
|
||||
http.ListenAndServe(listenAddr, router)
|
||||
}
|
||||
Reference in New Issue
Block a user