github.com/cellofellow/gopkg@v0.0.0-20140722061823-eec0544a62ad/web/doc.go (about) 1 // Copyright 2013 <chaishushan{AT}gmail.com>. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 /* 6 Package web is a lightweight web framework for Go. 7 8 It's ideal for writing simple, performant backend web services. 9 10 Example 11 12 package main 13 14 import ( 15 "github.com/chai2010/gopkg/web" 16 ) 17 18 func hello(val string) string { return "hello " + val } 19 20 func main() { 21 web.Get("/(.*)", hello) 22 web.Run("0.0.0.0:9999") 23 } 24 25 Getting parameters 26 27 package main 28 29 import ( 30 "github.com/chai2010/gopkg/web" 31 ) 32 33 func hello(ctx *web.Context, val string) { 34 for k,v := range ctx.Params { 35 println(k, v) 36 } 37 } 38 39 func main() { 40 web.Get("/(.*)", hello) 41 web.Run("0.0.0.0:9999") 42 } 43 44 In this example, if you visit `http://localhost:9999/?a=1&b=2`, 45 you'll see the following printed out in the terminal: 46 47 a 1 48 b 2 49 */ 50 package web