Example #1
0
func main() {
	web.Get("/", root)
	web.Get("/404", notfound)
	web.Get("/teapot", teapot)
	web.Get("/generic", generic)
	web.Run(":3000")
}
Example #2
0
func main() {
	f, err := os.Create("server.log")
	if err != nil {
		println(err)
		return
	}
	logger := log.New(f, "", log.Ldate|log.Ltime)
	web.Get("/(.*)", hello)
	web.SetLogger(logger)
	web.Run(":3000")
}
Example #3
0
func main() {
	web.Get("/", root)
	web.Get("/a", a)
	web.Get("/b", b)
	web.Get("/c", c)
	web.Get("/d", d)
	web.Get("/e", e)
	web.Get("/f", myhandlertype("return io.Reader"))
	web.Get("/g", g)
	web.Get("/h", h)
	web.Get("/i", i)
	web.Get("/j", j)
	web.Run(":3000")
}
Example #4
0
func main() {
	rand.Seed(time.Now().UnixNano())
	web.Config.CookieSecret = "7C19QRmwf3mHZ9CPAaPQ0hsWeufKd"
	web.Get("/said", func() string { return form })
	web.Post("/say", func(ctx *web.Context) string {
		uid := strconv.FormatInt(rand.Int63(), 10)
		ctx.SetSecureCookie("user", uid, 3600)
		users[uid] = ctx.Params["said"]
		return `<a href="/final">Click Here</a>`
	})
	web.Get("/final", func(ctx *web.Context) string {
		uid, _ := ctx.GetSecureCookie("user")
		return "You said " + users[uid]
	})
	web.Run("0.0.0.0:9999")
}
Example #5
0
func main() {
	web.Get("/", root)
	web.Post("/process", process)
	web.Run(":3000")
}
Example #6
0
func main() {
	// Add AuthHandler to our PreModule list
	web.AddPreModule(AuthHandler)
	web.Get("/(.*)", Hello)
	web.Run("0.0.0.0:9999")
}
Example #7
0
func main() {
	web.Config.CookieSecret = "7C19QRmwf3mHZ9CPAaPQ0hsWeufKd"
	web.Get("/", root)
	web.Post("/say", say)
	web.Run(":3000")
}
Example #8
0
File: hello.go Project: xyproto/web
func main() {
	web.Get("/(.*)", hello)
	web.Run(":3000")
}
Example #9
0
func main() {
	web.Websocket("/(.*)", root)
	web.Run(":3000")
}
Example #10
0
func main() {
	// Wrap everything in the AuthHandler
	web.AddWrapper(AuthHandler)
	web.Get("/(.*)", Hello)
	web.Run(":3000")
}
Example #11
0
func main() {
	web.AddWrapper(web.CompressWrapper)
	web.Get("/", root)
	web.Run(":3000")
}
Example #12
0
File: hello.go Project: skammer/web
func main() {
	web.Get("/plain/(.*)", plain)
	web.Get("/(.*)", hello)
	web.Run("0.0.0.0:9999")
}