示例#1
0
文件: main.go 项目: muyiwaolurin/tri
// User ...
func User(c lars.Context) {

	ctx := c.(*MyContext)

	id := c.Param("id")

	var username string

	// username = ctx.AppContext.DB.find(user by id.....)

	ctx.AppContext.Log.Println("Found User")

	c.Response().Write([]byte("Welcome " + username + " with id " + id))
}
示例#2
0
文件: main.go 项目: muyiwaolurin/tri
// UserProfile ...
func UserProfile(c lars.Context) {

	ctx := c.(*MyContext)

	id := c.Param("id")

	var profile string

	// profile = ctx.AppContext.DB.find(user profile by .....)

	ctx.AppContext.Log.Println("Found User Profile")

	c.Response().Write([]byte("Here's your profile " + profile + " user " + id))
}
示例#3
0
func route2a(ctx *lars.Context) {
	ctx.Response.Write([]byte("Route 2a " + ctx.Param("name")))
}