示例#1
0
文件: context.go 项目: jbaikge/goci
func init_context(req *http.Request) (c *Context) {
	session, err := store.Get(req, appname)
	if err != nil {
		log.Println("store err:", err)
	}
	c = &Context{
		Session: session,
		Meta:    base_meta.Dup(),
		Data:    d{},
		State:   worker.GetState(),
		Context: worker.NewContext(),
	}

	if req.URL.Path != "/" {
		c.Meta.Nav.SetActive(req.URL.Path)
	}

	return
}
示例#2
0
文件: handlers.go 项目: tcard/goci
func handle_status(w http.ResponseWriter, req *http.Request) {
	w.Header().Set("Content-type", "text/plain")
	fmt.Fprint(w, worker.GetState())
}