Skip to content

albrow/people

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

People

An simple HTTP/JSON API written in Go.

People uses the following libraries:

Installation

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.

Redis

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.

Demo

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.

Demo

API Documentation

GET /people

Returns a list of all people.

POST /people

Parameters:

  • Age: int
  • Name: string

Creates a new person.

GET /people/{id}

Gets and returns a single person with the given id.

PATCH /people/{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.

DELETE /people/{id}

Removes the person with the given id from the list.

About

A simple HTTP/JSON API written in Go using the Negroni middleware library and Zoom as a datastore.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages