An simple HTTP/JSON API written in Go.
People uses the following libraries:
- github.com/albrow/forms
- github.com/albrow/negroni-json-recovery
- github.com/albrow/zoom
- github.com/codegangsta/negroni
- github.com/gorilla/mux
- github.com/unrolled/render
People requires Go version >= 1.5 with GO15VENDOREXPERIMENT=1
. As of Go 1.6
the vendor experiment is enabled by default.
Run go get -u github.com/albrow/people
, which will automatically install the
source code into the correct location at $GOPATH/src/github.com/albrow/people
.
To start the server, change into the project root directory and run
go run main.go
. The server runs on port 3000.
Since People uses Zoom as a datastore, it
needs to connect to a Redis database. Follow these
instructions to install Redis. People will
connect to Redis on the default port, localhost:6379
, and use database 1.
I strongly recommend httpie for quickly
sending requests to the server from the command line (e.g.,
http GET :3000/people
). You could also use curl
or any other HTTP client.
Returns a list of all people.
Parameters:
- Age:
int
- Name:
string
Creates a new person.
Gets and returns a single person with the given id.
Parameters:
- Age:
int
- Name:
string
Update the person with the given id. Parameters are optional and any that are not provided will remain unchanged.
Removes the person with the given id from the list.