Example #1
0
File: main.go Project: 0x7cc/rsc
func (t *thumb) Get(ctxt *websrv.Context) {
	png, err := db.Thumb(t.Doc, t.Page, t.DPI)
	if err != nil {
		panic(err)
	}
	ctxt.Write(png)
}
Example #2
0
File: main.go Project: 0x7cc/rsc
func sendJson(ctxt *websrv.Context, obj interface{}) {
	data, err := json.Marshal(obj)
	if err != nil {
		panic(err)
	}
	ctxt.Header().Set("Content-Type", "application/json")
	ctxt.Write(data)
}