Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
29 lines (22 sloc) 594 Bytes
package app
import (
"github.com/thinkoner/thinkgo/context"
"github.com/thinkoner/thinkgo/router"
)
type RouteHandler struct {
Route *router.Route
}
// NewRouteHandler The default RouteHandler
func NewRouteHandler(app *Application) Handler {
return &RouteHandler{
Route: app.GetRoute(),
}
}
// Process Process the request to a router and return the response.
func (h *RouteHandler) Process(request *context.Request, next Closure) interface{} {
rule, err := h.Route.Dispatch(request)
if err != nil {
return context.NotFoundResponse()
}
return router.RunRoute(request, rule)
}
You can’t perform that action at this time.