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-10-21 01:57:31 +02:00
|
|
|
if err := e.Start(":1323"); err != nil {
|
2016-10-23 22:37:04 +02:00
|
|
|
e.Logger.Fatal(err)
|
2016-10-21 01:57:31 +02:00
|
|
|
}
|
2016-10-20 20:30:53 +02:00
|
|
|
}
|