mirror of
https://github.com/kataras/iris.git
synced 2025-01-24 03:01:03 +01:00
42b123975c
Former-commit-id: 90c05e743052bc3722e7fefaa0cbb0ed5153a1fb
29 lines
602 B
Go
29 lines
602 B
Go
package main
|
|
|
|
import (
|
|
"github.com/kataras/iris"
|
|
)
|
|
|
|
func main() {
|
|
app := iris.New()
|
|
// $ go get -u github.com/jteeuwen/go-bindata/...
|
|
// $ go-bindata ./templates/...
|
|
// $ go build
|
|
// $ ./embedding-templates-into-app
|
|
// html files are not used, you can delete the folder and run the example
|
|
app.RegisterView(iris.HTML("./templates", ".html").Binary(Asset, AssetNames))
|
|
app.Get("/", hi)
|
|
|
|
// http://localhost:8080
|
|
app.Run(iris.Addr(":8080"))
|
|
}
|
|
|
|
type page struct {
|
|
Title, Name string
|
|
}
|
|
|
|
func hi(ctx iris.Context) {
|
|
ctx.ViewData("", page{Title: "Hi Page", Name: "iris"})
|
|
ctx.View("hi.html")
|
|
}
|