serve command (http api)

This pull request adds a serve command which hosts a http server that listens for POST and GET requests. At the moment it's only possible to GET and POST individual blocks (blobs?).

I decided against implementing the API like it was described [in issue #2](https://github.com/jbenet/ipfs/issues/2) because
* having a /ctrl/add path is not restful since / is the location where the POSTed files end up
* distinguishing between uploaded blocks and files is unnecessary since a client can just chop the file up themselves if they want a chunked upload
A fair point, forgot that ports below 1024 require root. 8080 makes more
sense as a default.


On Thu, Aug 7, 2014 at 1:22 AM, Jeromy Johnson <notifications@github.com>
wrote:

> In cmd/ipfs/serve.go:
>
> > +	"github.com/gonuts/flag"
> > +	"github.com/jbenet/commander"
> > +	h "github.com/jbenet/go-ipfs/http"
> > +	"strconv"
> > +)
> > +
> > +var cmdIpfsServe = &commander.Command{
> > +	UsageLine: "serve",
> > +	Short:     "Serve an HTTP API",
> > +	Long:      `ipfs serve - Serve an http gateway into ipfs.`,
> > +	Run:       serveCmd,
> > +	Flag:      *flag.NewFlagSet("ipfs-serve", flag.ExitOnError),
> > +}
> > +
> > +func init() {
> > +	cmdIpfsServe.Flag.Uint("port", 80, "Port number")
>
> I dont know how i feel about defaulting to 80, since that requires super
> user priveleges on most systems
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/jbenet/go-ipfs/pull/24/files#r15907722>.
>