mirror of
https://github.com/jimeh/ozu.io.git
synced 2026-02-19 08:06:39 +00:00
20 lines
489 B
Go
20 lines
489 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(shortener *shortener.Shortener) *routing.Router {
|
|
router := routing.New()
|
|
handlers := Handlers{shortener}
|
|
|
|
router.Get("/", handlers.Index)
|
|
router.Get("/api/shorten", handlers.Shorten)
|
|
router.Get("/api/lookup", handlers.Lookup)
|
|
router.Get("/<uid>", handlers.LookupAndRedirect)
|
|
|
|
return router
|
|
}
|