2015-02-09 22:23:42 -08:00
|
|
|
package main
|
|
|
|
|
2015-02-09 22:33:17 -08:00
|
|
|
import (
|
|
|
|
"net/http"
|
2015-02-09 23:11:06 -08:00
|
|
|
"os"
|
2015-02-09 23:01:28 -08:00
|
|
|
|
|
|
|
"github.com/elazarl/go-bindata-assetfs"
|
|
|
|
"mcquay.me/web"
|
2015-02-09 22:33:17 -08:00
|
|
|
)
|
2015-02-09 22:23:42 -08:00
|
|
|
|
|
|
|
func main() {
|
2015-02-09 23:11:06 -08:00
|
|
|
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"))
|
|
|
|
}
|
2015-02-09 22:23:42 -08:00
|
|
|
http.Handle(
|
|
|
|
"/",
|
2015-02-09 23:11:06 -08:00
|
|
|
http.FileServer(fs),
|
2015-02-09 22:23:42 -08:00
|
|
|
)
|
|
|
|
if err := http.ListenAndServe(":8000", nil); err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|