Documentation
¶
Overview ¶
Package api provides the common resources for go chi API handlers and routers for the State Server API, namely error responses and RFC 7946 GeoJSON schema structs for serializing and deserializing JSON
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BadRequestError ¶
creates the go-chi renderer for HTTP 400 responses
func InternalServerError ¶
creates the go-chi renderer for HTTP 500 responses
func NotFoundError ¶
creates the go-chi renderer for HTTP 404 responses
Types ¶
type ErrorResponse ¶
type ErrorResponse struct { Err error `json:"-"` StatusText string `json:"status"` ErrorText string `json:"error,omitempty"` HTTPStatusCode int `json:"-"` }
Schema for any non-200 HTTP response
func (*ErrorResponse) Render ¶
func (e *ErrorResponse) Render(w http.ResponseWriter, r *http.Request) error
render method which hooks into the go-chi renderer and ensures the correct HTTP response status code is writtern to the response
type Feature ¶
type Feature struct { Type string `json:"type"` Properties Properties `json:"properties"` Geometry Geometry `json:"geometry"` }
GeoJSON schema for a feature object
type FeatureCollection ¶
GeoJSON schema for a FeatureCollection object to represent a collection of several states
func (FeatureCollection) Render ¶
func (scr FeatureCollection) Render(w http.ResponseWriter, r *http.Request) error
type Geometry ¶
type Geometry struct { Type string `json:"type"` Coordinates [][]geospatial.Coordinate `json:"coordinates"` }
GeoJSON schema for the geometry object of a feature
type Properties ¶
type Properties struct {
State string `json:"state"`
}
GeoJSON schema for the properties object of a feature
Directories
¶
Path | Synopsis |
---|---|
Package backend provides an in-memory thread-safe data store for creating and accessing [geospatial.State] objects.
|
Package backend provides an in-memory thread-safe data store for creating and accessing [geospatial.State] objects. |
Package location provides the router and handler for the State Server endpoint which finds the state(s) in which a given location is contained
|
Package location provides the router and handler for the State Server endpoint which finds the state(s) in which a given location is contained |
Package states provides the REST API endpoints needed for CRUD operations on geospatial state objects in the backend data store
|
Package states provides the REST API endpoints needed for CRUD operations on geospatial state objects in the backend data store |