web

package
v0.0.0-...-9da61a2 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2019 License: MIT Imports: 2 Imported by: 5

Documentation

Index

Constants

View Source
const (

	// ProjectsURL is the URL path to manage Projects
	ProjectsURL = "/" + apiVersion + "/projects"

	// PullRequestsURL is the URL path to manage Pull Requests
	PullRequestsURL = "/" + apiVersion + "/pull_requests"

	// UsersURL is the URL path to manage Users
	UsersURL = "/" + apiVersion + "/users"
)

Variables

This section is empty.

Functions

func WriteResponse

func WriteResponse(w http.ResponseWriter, status int, payload interface{})

WriteResponse writes a payload to the provided writer

Types

type API

type API interface {
	Controllers() []Controller
}

API defines a set of controllers which constitute the whole API of the application

type Controller

type Controller interface {
	Routes() []Route
}

Controller defines a set of HTTP routes

type ErrorResponse

type ErrorResponse struct {
	Error string `json:"error"`
}

ErrorResponse defines an error response payload

type HandleFunc

type HandleFunc func(w http.ResponseWriter, r *http.Request)

HandleFunc defines a function type needed for Route constructions

type Route

type Route struct {
	Path       string
	Method     string
	HandleFunc HandleFunc
}

Route defines a route that will be attached to a router

Jump to

Keyboard shortcuts

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