mirror of
https://github.com/cubixle/tuu.git
synced 2026-04-30 10:28:48 +01:00
adds ability to set an env in the app context
This commit is contained in:
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
func main() {
|
||||
router := tuu.NewRouter()
|
||||
|
||||
router.SetEnv("dev")
|
||||
router.GET("/home", func(ctx tuu.Context) error {
|
||||
ctx.Set("template_data", "some value")
|
||||
|
||||
@@ -26,7 +26,11 @@ func main() {
|
||||
})
|
||||
|
||||
app := tuu.New(router)
|
||||
if err := app.Serve(); err != nil {
|
||||
if err := app.Serve(tuu.Config{
|
||||
IPAddr: "127.0.0.1",
|
||||
Port: "8080",
|
||||
Env: "dev",
|
||||
}); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user