mirror of
https://github.com/pgsty/minio.git
synced 2026-07-20 12:40:24 +03:00
miniosd is now an http server, responds with hello world at root.
This commit is contained in:
+5
-2
@@ -1,7 +1,10 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import "fmt"
|
import (
|
||||||
|
"github.com/minios/minios"
|
||||||
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
fmt.Println("hello")
|
server := minios.Server{}
|
||||||
|
server.Start()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user