mirror of
https://github.com/kataras/iris.git
synced 2025-01-23 18:51:03 +01:00
3945fa68d1
We have to do the same on iris-contrib/examples, iris-contrib/middleware and e.t.c. Former-commit-id: 0860688158f374bc137bc934b81b26dcd0e10964
29 lines
575 B
Go
29 lines
575 B
Go
package main
|
|
|
|
import (
|
|
"html/template"
|
|
|
|
"github.com/kataras/iris/v12"
|
|
)
|
|
|
|
func main() {
|
|
app := iris.New()
|
|
|
|
tmpl := iris.Pug("./templates", ".pug")
|
|
tmpl.Reload(true) // reload templates on each request (development mode)
|
|
tmpl.AddFunc("bold", func(s string) (template.HTML, error) { // add your template func here.
|
|
return template.HTML("<b>" + s + "</b>"), nil
|
|
})
|
|
|
|
app.RegisterView(tmpl)
|
|
|
|
app.Get("/", index)
|
|
|
|
// http://localhost:8080
|
|
app.Run(iris.Addr(":8080"))
|
|
}
|
|
|
|
func index(ctx iris.Context) {
|
|
ctx.View("index.pug")
|
|
}
|