miniosd is now an http server, responds with hello world at root.

This commit is contained in:
Frederick F. Kautz IV 2014-11-01 21:05:40 -07:00
parent 111b2639cd
commit e58cada88c
2 changed files with 26 additions and 2 deletions

View File

@ -1,7 +1,10 @@
package main
import "fmt"
import (
"github.com/minios/minios"
)
func main() {
fmt.Println("hello")
server := minios.Server{}
server.Start()
}

21
server.go Normal file
View File

@ -0,0 +1,21 @@
package minios
import (
"fmt"
"github.com/gorilla/mux"
"net/http"
)
type Server struct {
}
func (server *Server) Start() error {
r := mux.NewRouter()
r.HandleFunc("/", HelloHandler)
fmt.Println("Running http server on port 8080")
return http.ListenAndServe(":8080", r)
}
func HelloHandler(w http.ResponseWriter, req *http.Request) {
fmt.Fprintf(w, "Host: "+req.Host)
}