Documentation ¶
Overview ¶
Package catena implements a simple social graph API.
Index ¶
Constants ¶
const Version = "v0.1"
Version of the Catena server and package.
Variables ¶
var ( NotFound = &ErrorHandler{status: http.StatusNotFound, message: http.StatusText(http.StatusNotFound)} MethodNotAllowed = &ErrorHandler{status: http.StatusMethodNotAllowed, message: http.StatusText(http.StatusMethodNotAllowed)} )
Default ErrorHandlers for standard http request errors
Functions ¶
func PanicHandler ¶
func PanicHandler(w http.ResponseWriter, r *http.Request, ctx interface{})
PanicHandler allows the application to recover from panics and
func Routes ¶
func Routes() *httprouter.Router
Routes creates and configures the server multiplexer with the API endpoints and methods, it does not add any additional middleware and primarily serves as documentation for how the API is configured.
Types ¶
type Catena ¶
Catena is an API server.
type ErrorHandler ¶
type ErrorHandler struct {
// contains filtered or unexported fields
}
ErrorHandler implements http.Handler for writing JSON API errors to the client and also implements error so that it can be used as an error to return from handler methods and written to http responses in middleware.
func (*ErrorHandler) ServeHTTP ¶
func (e *ErrorHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP replies to a request by writing the error message as json with the code and the message, writting the http status code. It does not otherwise end the request the caller should ensure no further writes are done to w.
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
makemigrations
Use with go generate to create database migrations in the migrations folder.
|
Use with go generate to create database migrations in the migrations folder. |
Package config implements the catena server configuration.
|
Package config implements the catena server configuration. |
Package logs implements simple hierarchical logging functionality for debugging and logging.
|
Package logs implements simple hierarchical logging functionality for debugging and logging. |
Package migrations manages the state of the Catena database.
|
Package migrations manages the state of the Catena database. |