fletcherist / zero

Golang toolkit for web development

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Zero

toolkit with the most common functions for backend development

Examples

Start an http server

zero.Handle("/test", func(srv *zero.Server) {
  name := srv.GetParam("name")
  srv.HTML([]byte("Hello "+name))
})
zero.Serve("8080")

Start websocket server

zero.Handle("/websocket", func(srv *zero.Server) {
  soc := srv.UpgradeWS()
  soc.HandleAll()
})
zero.Serve("8080")

Modules

Stat module

Stat module allow you to absorb app stats and get them once every configured period of time Example:

stat := zero.Stat{}
stat.Init(time.Minute*5, func(eventName string, counter zero.StatCounter) {
  fmt.Println("for every key like", eventName, "you will ge counter object")
})

// adding event to stat
stat.Inc("some_event_name")

About

Golang toolkit for web development


Languages

Language:Go 100.0%