2016-10-20 20:30:53 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
2016-10-20 20:51:15 +02:00
|
|
|
rice "github.com/GeertJohan/go.rice"
|
2016-10-20 20:30:53 +02:00
|
|
|
"github.com/labstack/echo"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
e := echo.New()
|
|
|
|
// the file server for rice. "app" is the folder where the files come from.
|
|
|
|
assetHandler := http.FileServer(rice.MustFindBox("app").HTTPBox())
|
|
|
|
// serves the index.html from rice
|
2016-10-20 20:51:15 +02:00
|
|
|
e.GET("/", echo.WrapHandler(assetHandler))
|
2016-10-20 20:30:53 +02:00
|
|
|
|
|
|
|
// servers other static files
|
2016-10-20 20:51:15 +02:00
|
|
|
e.GET("/static/*", echo.WrapHandler(http.StripPrefix("/static/", assetHandler)))
|
|
|
|
|
2016-11-18 02:21:41 +02:00
|
|
|
e.Logger.Fatal(e.Start(":1323"))
|
2016-10-20 20:30:53 +02:00
|
|
|
}
|