2018-05-26 21:49:48 +02:00
|
|
|
package main
|
|
|
|
|
2020-09-05 07:34:09 +02:00
|
|
|
import (
|
|
|
|
"html/template"
|
2018-05-26 21:49:48 +02:00
|
|
|
|
2020-09-05 07:34:09 +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")
|
2020-09-05 07:34:09 +02:00
|
|
|
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
|
|
|
|
})
|
|
|
|
|
2018-05-26 21:49:48 +02:00
|
|
|
app.RegisterView(tmpl)
|
|
|
|
|
|
|
|
app.Get("/", index)
|
|
|
|
|
|
|
|
// http://localhost:8080
|
2020-03-05 21:41:27 +01:00
|
|
|
app.Listen(":8080")
|
2018-05-26 21:49:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func index(ctx iris.Context) {
|
2020-09-05 07:34:09 +02:00
|
|
|
ctx.View("index.pug")
|
2018-05-26 21:49:48 +02:00
|
|
|
}
|