Refactor shortner and web packages for new Store interface

This commit is contained in:
2016-12-04 23:01:51 +00:00
parent d86f3d8218
commit de2ec75696
7 changed files with 193 additions and 133 deletions

View File

@@ -3,14 +3,15 @@ package web
import (
"net/url"
"github.com/jimeh/ozu.io/storage"
"github.com/qiangxue/fasthttp-routing"
)
func makeResponse(c *routing.Context, uid []byte, url []byte) Response {
func makeResponse(c *routing.Context, r *storage.Record) Response {
return Response{
UID: string(uid),
URL: makeShortURL(c, uid),
Target: string(url),
UID: string(r.UID),
URL: makeShortURL(c, r.UID),
Target: string(r.URL),
}
}