httpd

package
v0.0.0-...-1b8d80d Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2022 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Overview

Package httpd provides all the endpoints

Index

Constants

This section is empty.

Variables

View Source
var (
	//ErrMalformedJSON reports a JSON message that cannot be mapped to a struct
	ErrMalformedJSON = errors.New("Malformed json message")
	//ErrNotActivatedAccount refines a schema.ErrCredential when the user never logged before.
	ErrNotActivatedAccount = errors.New("You did not activate the account. Check for the invitation mail in this email mailbox")
)

Functions

func Mon

Mon monitores the requests

Types

type EndPoint

type EndPoint func(Exchange) error

EndPoint aliases the call to an endpoint

type EndPoints

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

EndPoints is a wrapper to embeds a set of Rest endpoints

func NewEndPoints

func NewEndPoints(not *notifier.Notifier, store *sqlstore.Store, convs feeder.Conventions, cfg config.Rest, org config.Internships) EndPoints

NewEndPoints creates new prefixed endpoints

type Exchange

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

Exchange is a simple utility struct to gather the element manipulated while communicating with a client within a session

func (*Exchange) V

func (ex *Exchange) V(id string) string

V returns the value of the given parameter.

type HTTPd

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

HTTPd just wrap a HTTP daemon that will serve both the static assets and the rest endpoints

func NewHTTPd

func NewHTTPd(not *notifier.Notifier, store *sqlstore.Store, conventions feeder.Conventions, cfg config.HTTPd, org config.Internships) HTTPd

NewHTTPd makes a new HTTP daemon

func (*HTTPd) Listen

func (ed *HTTPd) Listen() error

Listen starts listening

type MonResponseWriter

type MonResponseWriter struct {
	http.ResponseWriter
	// contains filtered or unexported fields
}

MonResponseWriter embeds a responsewriter to save the status code then to provide a proper monitoring

func NewMonResponseWriter

func NewMonResponseWriter(res http.ResponseWriter) *MonResponseWriter

NewMonResponseWriter makes a new monitoring response writer

func (*MonResponseWriter) Header

func (w *MonResponseWriter) Header() http.Header

Header delegates to the underlyning writer

func (*MonResponseWriter) Status

func (w *MonResponseWriter) Status() int

Status returns the status code provided by WriteHeader

func (*MonResponseWriter) Write

func (w *MonResponseWriter) Write(data []byte) (int, error)

Writer delegates to the underlyning writer

func (*MonResponseWriter) WriteHeader

func (w *MonResponseWriter) WriteHeader(statusCode int)

WriteHeader saves the status code and delegates to the underlyning writer

Jump to

Keyboard shortcuts

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