router

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 16, 2017 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package Router, returns instance for express Router Functions defined here are extended by express.go itself

Express Router takes the url regex as similar to the js one Router.Get("/:param") will return the param in Response.Params["param"]

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Middleware

type Middleware func(request *request.Request, response *response.Response, next func())

Middleware function singature type

type NextFunc

type NextFunc func(NextFunc)

An extension type to help loop of lookup in express.go

type Route

type Route struct {
	// contains filtered or unexported fields
}

A Route contains a regexp and a Router.Middleware type handler

type Router

type Router struct {
	// contains filtered or unexported fields
}

Collection of all method types routers

func (*Router) Delete

func (r *Router) Delete(url string, middleware Middleware) *Router

func (*Router) FindNext

func (r *Router) FindNext(index int, method string, url string, request *request.Request) (Middleware, int, bool)

Finds the suitable router for given url and method It returns the middleware if found and a cursor index of array

func (*Router) Get

func (r *Router) Get(url string, middleware Middleware) *Router

func (*Router) Init

func (r *Router) Init()

Intialise the Router defaults

func (*Router) Patch

func (r *Router) Patch(url string, middleware Middleware) *Router

func (*Router) Post

func (r *Router) Post(url string, middleware Middleware) *Router

func (*Router) Put

func (r *Router) Put(url string, middleware Middleware) *Router

func (*Router) Use

func (r *Router) Use(middleware interface{}) *Router

Router.Use can take a function or a new express.Router() instance as argument

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL