mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-30 10:10:21 +00:00
24 lines
448 B
Go
24 lines
448 B
Go
package main
|
|
|
|
import (
|
|
"github.com/emicklei/go-restful"
|
|
"io"
|
|
"log"
|
|
"net/http"
|
|
)
|
|
|
|
// This example shows the minimal code needed to get a restful.WebService working.
|
|
//
|
|
// GET http://localhost:8080/hello
|
|
|
|
func main() {
|
|
ws := new(restful.WebService)
|
|
ws.Route(ws.GET("/hello").To(hello))
|
|
restful.Add(ws)
|
|
log.Fatal(http.ListenAndServe(":8080", nil))
|
|
}
|
|
|
|
func hello(req *restful.Request, resp *restful.Response) {
|
|
io.WriteString(resp, "world")
|
|
}
|