Skip to content

Commit 9b42f50

Browse files
committed
move database testing to top
1 parent ad0e174 commit 9b42f50

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

app.go

+11-12
Original file line numberDiff line numberDiff line change
@@ -64,19 +64,7 @@ func lobby_handler(writer http.ResponseWriter, request *http.Request) {
6464
}
6565

6666
func main() {
67-
// Static file serving
68-
server := http.FileServer(http.Dir("./static"))
69-
http.Handle("/static/", http.StripPrefix("/static/", server))
70-
71-
http.HandleFunc("/", home_handler)
72-
http.HandleFunc("/login/", login_handler)
73-
http.HandleFunc("/register/", register_handler)
74-
http.HandleFunc("/lobby/", lobby_handler)
75-
76-
log.Fatal(http.ListenAndServe(":8000", nil))
77-
7867
// Database testing
79-
8068
var err error
8169

8270
config := mysql.Config{
@@ -93,4 +81,15 @@ func main() {
9381
err = db.Ping()
9482
handle(err)
9583
fmt.Println("Success")
84+
85+
// Static file serving
86+
server := http.FileServer(http.Dir("./static"))
87+
http.Handle("/static/", http.StripPrefix("/static/", server))
88+
89+
http.HandleFunc("/", home_handler)
90+
http.HandleFunc("/login/", login_handler)
91+
http.HandleFunc("/register/", register_handler)
92+
http.HandleFunc("/lobby/", lobby_handler)
93+
94+
log.Fatal(http.ListenAndServe(":8000", nil))
9695
}

0 commit comments

Comments
 (0)