Beispiel #1
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")
}
Beispiel #2
0
func main() {

	config := tls.Config{
		Time: nil,
	}

	config.Certificates = make([]tls.Certificate, 1)
	var err error
	config.Certificates[0], err = tls.X509KeyPair(SERVER_CERT, SERVER_KEY)
	if err != nil {
		fmt.Println(err)
	}

	web.Get("/(.*)", hello)
	web.RunSecure("0.0.0.0:9998", config)
}
Beispiel #3
0
Datei: hello.go Projekt: rday/web
func main() {
	web.Get("/plain/(.*)", plain)
	web.Get("/(.*)", hello)
	web.Run("0.0.0.0:9999")
}
Beispiel #4
0
func main() {
	// Add AuthHandler to our PreModule list
	web.AddPreModule(AuthHandler)
	web.Get("/(.*)", Hello)
	web.Run("0.0.0.0:9999")
}