httpapi

package module
v0.0.0-...-6a46f16 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2013 License: MIT Imports: 6 Imported by: 0

README

httpapi

Writing HTTP API services in Go. Still in progress, check back later for better API and documentation.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	// RequestStruct is a struct to store the fields of request
	// paramemters, passed as JSON from the client.
	RequestStruct interface{}
}

Handler handles a single API endpoint

func (Handler) ServeHTTP

func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

FIXME: best way to report errors in ServerHTTP?

type RequestParams

type RequestParams interface {
	// HandleRequest is called when a request comes in. POST body will
	// be decoded into the receiver; returned value will be encoded to
	// JSON before responding to the client.
	// FIXME: pre-define errors for appropriate HTTP codes (404, 500) ...
	HandleRequest() (interface{}, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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