Beispiel #1
0
func main() {
	e := vodka.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"))
}
Beispiel #2
0
func main() {
	e := vodka.New()
	e.Use(middleware.Logger())
	e.Use(middleware.Recover())
	e.Use(middleware.Static("../public"))
	e.GET("/ws", standard.WrapHandler(http.HandlerFunc(hello())))
	e.Run(standard.New(":1323"))
}
func (ceh *customVodkaHandler) mustWrapHandleFunc(c vodka.Context) vodka.HandlerFunc {
	if _, ok := c.Request().(*standard.Request); ok {
		return standard.WrapHandler(ceh.httpHandler)
	} else if _, ok = c.Request().(*fasthttp.Request); ok {
		return NewFastHTTPVodkaAdaptor(ceh.httpHandler)
	}

	log.Fatal("Unknown HTTP implementation")
	return nil
}