1
0
mirror of https://github.com/alice-lg/alice-lg.git synced 2024-05-11 05:55:03 +00:00

added static file handling

This commit is contained in:
Matthias Hannig
2017-05-16 15:22:40 +02:00
parent 543ef00a43
commit c6c88d621a
2 changed files with 33 additions and 1 deletions

7
backend/.gitignore vendored Normal file
View File

@@ -0,0 +1,7 @@
# Ignore static build in repo
rice-box.go
# Ignore builds
alice-lg-*

View File

@@ -1,7 +1,32 @@
package main
import ()
import (
"github.com/GeertJohan/go.rice"
"log"
"net/http"
)
func main() {
printBanner()
// Load configuration
// Serve static assets
assets := rice.MustFindBox("../client/build")
assetsHandler := http.StripPrefix(
"/static/",
http.FileServer(assets.HTTPBox()))
index, err := assets.String("index.html")
if err != nil {
log.Fatal(err)
}
log.Println(index)
http.Handle("/static/", assetsHandler)
// Start http server
http.ListenAndServe(":7340", nil)
}