static file handler to include bootstrap stylesheets

This commit is contained in:
Johannes 2022-09-21 15:40:16 +02:00
parent c737818ce4
commit 16e8cf9cd7
7 changed files with 27 additions and 1 deletions

View file

@ -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())

1
static/bootstrap Symbolic link
View file

@ -0,0 +1 @@
bootstrap-5.2.1-dist/

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -2,3 +2,8 @@
<meta name="keywords" content="Mathebau, Sprechstunde, Sprechstunden, Mathe, Mathematik, technische, Universität, Darmstadt, TU, Fachschaft">
<meta name="description" content="Eine Übersicht der Sprechstunden, die in den offenen Arbeitsräumen der Fachschaft Mathematik, TU Darmstadt, angeboten werden">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="/static/bootstrap/css/bootstrap.min.css">
<!-- TODO: include this at the very bottom of <body> after refactoring to base template
<script src="/static/bootstrap/js/bootstrap.bundle.min.js"></script>
-->