Bladeren bron

static file server installed for docRoot

master
sp 4 jaren geleden
bovenliggende
commit
169a7d232f
4 gewijzigde bestanden met toevoegingen van 28 en 1 verwijderingen
  1. +13
    -0
      go.sum
  2. +3
    -0
      html/css/index.css
  3. +9
    -0
      html/index.html
  4. +3
    -1
      main.go

+ 13
- 0
go.sum Bestand weergeven

@@ -0,0 +1,13 @@
github.com/VividCortex/mysqlerr v0.0.0-20201215173831-4c396ae82aac h1:4w4jPA8uNKNtkEcVmMwcjXwkLbCnPpx//7RPWQHGPUA=
github.com/VividCortex/mysqlerr v0.0.0-20201215173831-4c396ae82aac/go.mod h1:f3HiCrHjHBdcm6E83vGaXh1KomZMA2P6aeo3hKx/wg0=
github.com/brianvoe/gofakeit/v6 v6.0.1 h1:U8cuIYQQaIQBEloSbTk1hs5v5aDkoZHVq/pljqNA9qM=
github.com/brianvoe/gofakeit/v6 v6.0.1/go.mod h1:palrJUk4Fyw38zIFB/uBZqsgzW5VsNllhHKKwAebzew=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs=
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sirupsen/logrus v1.7.0 h1:ShrD1U9pZB12TX0cVy0DtePoCH97K8EtX+mg7ZARUtM=
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 h1:YyJpGZS1sBuBCzLAR1VEpK193GlqGZbnPFnPV/5Rsb4=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=

+ 3
- 0
html/css/index.css Bestand weergeven

@@ -0,0 +1,3 @@
H1 {
background-color:yellow;
}

+ 9
- 0
html/index.html Bestand weergeven

@@ -0,0 +1,9 @@
<head>
<title>Demo static index</title>
<link rel="stylesheet" type="text/css" href="css/index.css">
</head>
<body>
<h1> this is static file </h1>
<a href="css/index.css"> test link index.css </a>
</body>


+ 3
- 1
main.go Bestand weergeven

@@ -24,6 +24,9 @@ func main() {

func setupRootFileServer() {

fs := http.FileServer(http.Dir(config.DocRoot))
http.Handle("/", http.StripPrefix("/", fs))

}

func setupHTTPHandler() {
@@ -41,7 +44,6 @@ func setupHTTPHandler() {
http.HandleFunc("/spa/livecast", HelloHandler)
http.HandleFunc("/spa/editmeeting", HelloHandler)

http.HandleFunc("/", HelloHandler)
fmt.Printf("Server started at port %s\n", config.Port)
log.Fatal(http.ListenAndServe(config.Host+":"+config.Port, nil))


Laden…
Annuleren
Opslaan