Compare commits
3
Commits
static-dir
...
devmode
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8096c76b1e | ||
|
|
d98ef7a4a9 | ||
|
|
e5e9e5f494 |
+14
-3
@@ -3,14 +3,25 @@ package main
|
||||
import (
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
"github.com/elazarl/go-bindata-assetfs"
|
||||
"mcquay.me/web"
|
||||
)
|
||||
|
||||
func main() {
|
||||
var fs http.FileSystem
|
||||
if os.Getenv("SM_DEV") == "" {
|
||||
fs = &assetfs.AssetFS{
|
||||
Asset: web.Asset,
|
||||
AssetDir: web.AssetDir,
|
||||
Prefix: "static",
|
||||
}
|
||||
} else {
|
||||
fs = http.Dir(os.Getenv("SM_STATIC"))
|
||||
}
|
||||
http.Handle(
|
||||
"/",
|
||||
http.FileServer(
|
||||
http.Dir(os.Getenv("SM_STATIC")),
|
||||
),
|
||||
http.FileServer(fs),
|
||||
)
|
||||
if err := http.ListenAndServe(":8000", nil); err != nil {
|
||||
panic(err)
|
||||
|
||||
Reference in New Issue
Block a user