http

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2019 License: Apache-2.0 Imports: 13 Imported by: 2

Documentation

Overview

========================================================================= Copyright © 2019 AppsByRam authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. =========================================================================

========================================================================= Copyright © 2019 AppsByRam authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. =========================================================================

========================================================================= Copyright © 2019 AppsByRam authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. =========================================================================

========================================================================= Copyright © 2019 AppsByRam authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. =========================================================================

Index

Constants

View Source
const (
	//ContentTypeJSON represents JSON content type
	ContentTypeJSON = "application/json; charset=UTF-8"
	//ContentTypeXML represents XML content type
	ContentTypeXML = "application/xml; charset=UTF-8"
	//ContentTypeYaml represents yaml
	ContentTypeYaml = "application/x-yaml"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type HealthReport added in v0.0.4

type HealthReport struct {
	Status string `json:"status" yaml:"status"`
}

HealthReport represents a health report

type Payload

type Payload interface {
	RequestReader
	ResponseReadWriter
}

Payload represents an generic interface to read and write data from http

func NewPayload

func NewPayload() Payload

NewPayload initializes a new payload

type RequestReader

type RequestReader interface {
	ReadRequest(contentType string, data interface{}, r *http.Request) error
}

RequestReader request reader

type ResponseReadWriter

type ResponseReadWriter interface {
	WriteResponse(contentType string, status int, data interface{}, w http.ResponseWriter)
	ReadResponse(contentType string, data interface{}, response *http.Response) error
}

ResponseReadWriter response read writer

type Route

type Route struct {
	Name        string
	Method      string
	Pattern     string
	HandlerFunc http.HandlerFunc
}

Route defines an http route

type Routes

type Routes []Route

Routes is a collection of http routes supported by this web application

type Server

type Server interface {
	Start()
}

Server base http server

func NewServer

func NewServer(addr string, tls bool, certFile, keyFile string, routes Routes) Server

NewServer creates a new instance of http server

Jump to

Keyboard shortcuts

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