2018-05-26 21:49:48 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"html/template"
|
|
|
|
|
2019-10-25 00:27:02 +02:00
|
|
|
"github.com/kataras/iris/v12"
|
2018-05-26 21:49:48 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
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")
|
|
|
|
}
|