router

package
v0.9.6 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Route

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

Route A route contains a method (GET), URI, and a controller

type Router

type Router struct {
	Container       interface{}
	Routes          []Route
	ErrorController controller.Controller
}

Router A router contains routes and links back to the application and implements the ServeHTTP interface

func (*Router) Get

func (r *Router) Get(uri string, controller controller.Controller)

Get Create and add a new route into the router to handle a GET request

func (*Router) Post

func (r *Router) Post(uri string, controller controller.Controller)

Post Create and add a new route into the router to handle a POST request

func (*Router) Put

func (r *Router) Put(uri string, controller controller.Controller)

Put Create and add a new route into the router to handle a PUT request

func (*Router) ServeHTTP

func (r *Router) ServeHTTP(response http.ResponseWriter, request *http.Request)

ServeHTTP Serve a given HTTP request

func (*Router) StartAndServe

func (r *Router) StartAndServe(server Server) error

StartAndServe Start the HTTP server and listen for connections

type Server

type Server interface {
	ListenAndServe() error
}

Server Common interface for HTTP

Jump to

Keyboard shortcuts

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