Last active
August 18, 2019 02:50
-
-
Save L04DB4L4NC3R/6b11fd21e00089498afb7564b12f78ab to your computer and use it in GitHub Desktop.
Examinaar 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package controller | |
import ( | |
"html/template" | |
) | |
type Host struct { | |
temp \*template.Template | |
} | |
func (h Host) RegisterRoutes() { | |
http.HandleFunc("/host", h.servepage) | |
http.HandleFunc("/host/session/delete", h.removeSession) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// main function | |
func main() { | |
// handle requests to static files | |
http.Handle("/img/", http.FileServer(http.Dir("public"))) | |
http.Handle("/js/", http.FileServer(http.Dir("public"))) | |
http.Handle("/css/", http.FileServer(http.Dir("public"))) | |
http.Handle("/vendor/", http.FileServer(http.Dir("public"))) | |
controller.Startup(populateTemplates()) | |
log.Fatal(http.ListenAndServe(":3000", nil)) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package controller | |
import "html/template" | |
var user User | |
func Startup(t \*template.Template) { | |
host.temp = t | |
host.RegisterRoutes() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment