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"
|
||||||
"log/syslog"
|
"log/syslog"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
|
||||||
"officeHours/config"
|
"officeHours/config"
|
||||||
"officeHours/controllers"
|
"officeHours/controllers"
|
||||||
"officeHours/repositories"
|
"officeHours/repositories"
|
||||||
"officeHours/sqldb"
|
"officeHours/sqldb"
|
||||||
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -35,6 +35,9 @@ func main() {
|
||||||
log.Fatalf("%s: %s", "Reading JSON config file into config structure", err)
|
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)
|
db := sqldb.Connect(conf)
|
||||||
// Create repos
|
// Create repos
|
||||||
roomRepo := repositories.NewRoomRepo(db)
|
roomRepo := repositories.NewRoomRepo(db)
|
||||||
|
@ -50,6 +53,7 @@ func main() {
|
||||||
http.HandleFunc("/confirmRequest", h.ConfirmRequestHandler)
|
http.HandleFunc("/confirmRequest", h.ConfirmRequestHandler)
|
||||||
http.HandleFunc("/deleteOfficeHour", h.DeleteOfficeHourHandler)
|
http.HandleFunc("/deleteOfficeHour", h.DeleteOfficeHourHandler)
|
||||||
http.HandleFunc("/", h.RootHandler)
|
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)
|
err = http.ListenAndServe(fmt.Sprintf("%s:%d", conf.Server.ListenAddress, conf.Server.ListenPort), nil)
|
||||||
log.Println(err.Error())
|
log.Println(err.Error())
|
||||||
|
|
1
static/bootstrap
Symbolic link
1
static/bootstrap
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
bootstrap-5.2.1-dist/
|
7
static/bootstrap-5.2.1-dist/css/bootstrap.min.css
vendored
Normal file
7
static/bootstrap-5.2.1-dist/css/bootstrap.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
static/bootstrap-5.2.1-dist/css/bootstrap.min.css.map
Normal file
1
static/bootstrap-5.2.1-dist/css/bootstrap.min.css.map
Normal file
File diff suppressed because one or more lines are too long
7
static/bootstrap-5.2.1-dist/js/bootstrap.bundle.min.js
vendored
Normal file
7
static/bootstrap-5.2.1-dist/js/bootstrap.bundle.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -2,3 +2,8 @@
|
||||||
<meta name="keywords" content="Mathebau, Sprechstunde, Sprechstunden, Mathe, Mathematik, technische, Universität, Darmstadt, TU, Fachschaft">
|
<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="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">
|
<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>
|
||||||
|
-->
|
||||||
|
|
Loading…
Reference in a new issue