Commit b4fc0dba authored by Matt Bell's avatar Matt Bell Committed by Juan Batiz-Benet

cmd/ipfs: Added basic daemon command

parent b499c90d
package main
import (
"net/http"
cmds "github.com/jbenet/go-ipfs/commands"
cmdsHttp "github.com/jbenet/go-ipfs/commands/http"
)
var Daemon = &cmds.Command{
Options: []cmds.Option{},
Help: "TODO",
Subcommands: map[string]*cmds.Command{},
Run: daemonFunc,
}
func daemonFunc(req cmds.Request, res cmds.Response) {
handler := cmdsHttp.Handler{}
http.Handle(cmdsHttp.ApiPath+"/", handler)
// TODO: load listen address/port from config/options
err := http.ListenAndServe(":8080", nil)
if err != nil {
res.SetError(err, cmds.ErrNormal)
return
}
// TODO: log to indicate that we are now listening
}
...@@ -9,11 +9,6 @@ var Root = &cmds.Command{ ...@@ -9,11 +9,6 @@ var Root = &cmds.Command{
Options: commands.Root.Options, Options: commands.Root.Options,
Help: commands.Root.Help, Help: commands.Root.Help,
Subcommands: map[string]*cmds.Command{ Subcommands: map[string]*cmds.Command{
"test": &cmds.Command{ "daemon": Daemon,
Run: func(req cmds.Request, res cmds.Response) {
v := "hello, world"
res.SetValue(v)
},
},
}, },
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment