added development fileserving
This commit is contained in:
parent
d98ef7a4a9
commit
8096c76b1e
@ -2,21 +2,26 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"os"
|
||||||
|
|
||||||
"github.com/elazarl/go-bindata-assetfs"
|
"github.com/elazarl/go-bindata-assetfs"
|
||||||
"mcquay.me/web"
|
"mcquay.me/web"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
http.Handle(
|
var fs http.FileSystem
|
||||||
"/",
|
if os.Getenv("SM_DEV") == "" {
|
||||||
http.FileServer(
|
fs = &assetfs.AssetFS{
|
||||||
&assetfs.AssetFS{
|
|
||||||
Asset: web.Asset,
|
Asset: web.Asset,
|
||||||
AssetDir: web.AssetDir,
|
AssetDir: web.AssetDir,
|
||||||
Prefix: "static",
|
Prefix: "static",
|
||||||
},
|
}
|
||||||
),
|
} else {
|
||||||
|
fs = http.Dir(os.Getenv("SM_STATIC"))
|
||||||
|
}
|
||||||
|
http.Handle(
|
||||||
|
"/",
|
||||||
|
http.FileServer(fs),
|
||||||
)
|
)
|
||||||
if err := http.ListenAndServe(":8000", nil); err != nil {
|
if err := http.ListenAndServe(":8000", nil); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
Loading…
Reference in New Issue
Block a user