base server and base html

This commit is contained in:
lnino
2024-04-10 19:53:00 +02:00
commit e4b0fcdd9d
9 changed files with 138 additions and 0 deletions

28
main.go Normal file
View File

@@ -0,0 +1,28 @@
package main
import (
"fmt"
controller "infini/controller"
"net/http"
)
func main() {
fs := http.FileServer(http.Dir("assets/"))
http.Handle("/assets/", http.StripPrefix("/assets/", fs))
http.HandleFunc("/", controller.MainPage)
http.HandleFunc("/test", controller.TestPage)
// Print a message when the server is online
go func() {
fmt.Print("\n")
fmt.Println("Server is running on http://86.204.149.189:80")
fmt.Print("\n")
}()
err := http.ListenAndServe("0.0.0.0:8080", nil)
if err != nil {
fmt.Println("Erreur lors du démarrage du serveur:", err)
}
}