Example #1
0
File: logger.go Project: jjz/ztodo
func main() {
	f, err := os.Create("server.log")
	if err != nil {
		println(err.Error())
		return
	}
	logger := log.New(f, "", log.Ldate|log.Ltime)
	zweb.Get("/(.*)", hello)
	zweb.SetLogger(logger)
	zweb.Run("0.0.0.0:9999")
}
Example #2
0
File: app.go Project: jjz/ztodo
func main() {
	zweb.Get("/pullall/(.*)", pullall)
	zweb.Get("/getuser/(.*)", getuser)
	zweb.Get("/pullone/(.*)/(.*)", pullone)

	zweb.Post("/signup", signup)
	zweb.Post("/login", login)

	zweb.Post("/pushall/(.*)", pushall)
	zweb.Post("/pushone/(.*)", pushone)

	zweb.Get("/(.*)", pnf)
	zweb.Post("/(.*)", pnf)

	zweb.Run("0.0.0.0:9999")
}
Example #3
0
func main() {
	rand.Seed(time.Now().UnixNano())
	zweb.Config.CookieSecret = "7C19QRmwf3mHZ9CPAaPQ0hsWeufKd"
	zweb.Get("/", func(ctx *zweb.Context) string {
		ctx.Redirect(302, "/said")
		return ""
	})
	zweb.Get("/said", func() string { return form })
	zweb.Post("/say", func(ctx *zweb.Context) string {
		uid := fmt.Sprintf("%d\n", rand.Int63())
		ctx.SetSecureCookie("user", uid, 3600)
		users[uid] = ctx.Params["said"]
		return `<a href="/final">Click Here</a>`
	})
	zweb.Get("/final", func(ctx *zweb.Context) string {
		uid, _ := ctx.GetSecureCookie("user")
		return "You said " + users[uid]
	})
	zweb.Run("0.0.0.0:9999")
}
Example #4
0
func main() {
	zweb.Get("/([0-9]+)", hello)
	zweb.Run("0.0.0.0:9999")
}
Example #5
0
func main() {
	zweb.Get("/", index)
	zweb.Post("/multipart", multipart)
	zweb.Run("0.0.0.0:9999")
}
Example #6
0
File: params.go Project: jjz/ztodo
func main() {
	zweb.Get("/", index)
	zweb.Post("/process", process)
	zweb.Run("0.0.0.0:9999")
}