1
0
mirror of https://github.com/labstack/echo.git synced 2024-12-22 20:06:21 +02:00
echo/recipe/embed-resources/server.go
Vishal Rana f4b0004d2b website/recipe in the main repo
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-10-20 09:11:07 -07:00

22 lines
554 B
Go

package main
import (
"net/http"
"github.com/GeertJohan/go.rice"
"github.com/labstack/echo"
"github.com/labstack/echo/engine/standard"
)
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
e.GET("/", standard.WrapHandler(assetHandler))
// servers other static files
e.GET("/static/*", standard.WrapHandler(http.StripPrefix("/static/", assetHandler)))
e.Run(standard.New(":3000"))
}