36 lines
592 B
Go
36 lines
592 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"net/http"
|
|
|
|
"github.com/flamego/flamego"
|
|
"github.com/flamego/template"
|
|
)
|
|
|
|
func main() {
|
|
f := flamego.Classic()
|
|
|
|
// serve static files from ./public/
|
|
f.Use(flamego.Static(
|
|
flamego.StaticOptions{
|
|
Directory: "public",
|
|
},
|
|
))
|
|
|
|
// initialize template engine
|
|
f.Use(template.Templater(template.Options{
|
|
Directory: "./views",
|
|
}))
|
|
|
|
// register route handlers
|
|
f.Get("/", func(t template.Template, data template.Data) {
|
|
data["title"] = "Dashboard"
|
|
t.HTML(http.StatusOK, "index")
|
|
})
|
|
|
|
fmt.Println("test!!?")
|
|
|
|
f.Run()
|
|
}
|