static file handler to include bootstrap stylesheets
This commit is contained in:
parent
c737818ce4
commit
16e8cf9cd7
7 changed files with 27 additions and 1 deletions
6
main.go
6
main.go
|
@ -7,11 +7,11 @@ import (
|
|||
"log"
|
||||
"log/syslog"
|
||||
"net/http"
|
||||
"os"
|
||||
"officeHours/config"
|
||||
"officeHours/controllers"
|
||||
"officeHours/repositories"
|
||||
"officeHours/sqldb"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
@ -35,6 +35,9 @@ func main() {
|
|||
log.Fatalf("%s: %s", "Reading JSON config file into config structure", err)
|
||||
}
|
||||
|
||||
// serve static files
|
||||
staticHandler := http.FileServer(http.Dir("./static"))
|
||||
|
||||
db := sqldb.Connect(conf)
|
||||
// Create repos
|
||||
roomRepo := repositories.NewRoomRepo(db)
|
||||
|
@ -50,6 +53,7 @@ func main() {
|
|||
http.HandleFunc("/confirmRequest", h.ConfirmRequestHandler)
|
||||
http.HandleFunc("/deleteOfficeHour", h.DeleteOfficeHourHandler)
|
||||
http.HandleFunc("/", h.RootHandler)
|
||||
http.Handle("/static/", http.StripPrefix("/static/", staticHandler))
|
||||
|
||||
err = http.ListenAndServe(fmt.Sprintf("%s:%d", conf.Server.ListenAddress, conf.Server.ListenPort), nil)
|
||||
log.Println(err.Error())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue