Example #1
0
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
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)
}