Simple and easy go web micro framework
app.Use(accesslog.Middleware())
server.GET("/", Index).Use(accesslog.Middleware())
func TestLog(ctx dotweb.Context) error {
ctx.HttpServer().Logger().Info(dotweb.LogTarget_Default, "test log")
return ctx.WriteString("log page")
}
func main() {
fmt.Println(cryptos.GetRandString(10))
}
func main() {
app := dotweb.Classic("/home/logs/wwwroot/")
// if use this, all router will auto add "HEAD" method support
// default is false
app.HttpServer.SetEnabledAutoHEAD(true)
app.HttpServer.GET("/index", func(ctx dotweb.Context) error{
flag := ctx.HttpServer().Router().MatchPath(ctx, "/index")
return ctx.WriteString("welcome to my first web!" + ctx.RouterNode().Path() + " - " + fmt.Sprint(flag))
})
err := app.StartServer(80)
fmt.Println("dotweb.StartServer error => ", err)
}
【dotweb百版大战】 - https://github.com/devfeel/dotweb 正临新年之际,dotweb百版大战捷报传来!自创立以来,顺利完成100个版本的发布,感谢各位。 版本正式升级为1.6!
dotweb的每一小步成长,离不开大家的帮助,感谢。 https://github.com/devfeel/dotweb
app.UseTimeoutHook(dotweb.DefaultTimeoutHookHandler, time.Second * 2)
func AppMock() dotweb.Mock{
m := dotweb.NewStandardMock()
m.RegisterString("/", "mock data")
return m
}
app.SetMock(AppMock())
sessionConf := session.NewDefaultRedisConfig("redis://10.10.0.1:6322/1")
sessionConf.BackupServerUrl = "redis://10.10.0.1:6379/1"
What's new?
重要:go版本适配升级为1.9+
New features:
Bug fixed:
调整: