mirror of
https://github.com/jimeh/ozu.io.git
synced 2026-02-19 08:06:39 +00:00
Use go-bindata, html/templates, and lots of other changes to the web package.
22 lines
464 B
Go
22 lines
464 B
Go
package web
|
|
|
|
import (
|
|
"github.com/jimeh/ozu.io/shortener"
|
|
"github.com/qiangxue/fasthttp-routing"
|
|
)
|
|
|
|
// NewRouter creates a new routing.Router with all handlers registered.
|
|
func NewRouter(s shortener.Shortener) *routing.Router {
|
|
r := routing.New()
|
|
h := NewHandler(s)
|
|
|
|
r.Get("/", h.Index)
|
|
r.Get("/api/shorten", h.Shorten)
|
|
r.Get("/api/lookup", h.Lookup)
|
|
r.Get("/static/*", h.Static)
|
|
r.Get("/<uid>", h.LookupAndRedirect)
|
|
r.Get("/*", h.NotFound)
|
|
|
|
return r
|
|
}
|