示例#1
0
文件: service.go 项目: jmcvetta/lgtts
func NewWebService() *restful.WebService {
	ws := restful.WebService{}
	ws.Path("/api/v1").
		Consumes(restful.MIME_JSON).
		Produces(restful.MIME_JSON, restful.MIME_XML)
	ws.Route(ws.POST("/artists").To(createArtist).
		Doc("Create a new Arist").
		Reads(ArtistRequest{}))
	ws.Route(ws.POST("/artists/{artist-id}/patrons").To(patronize).
		Doc("Patronize an artist").
		Param(ws.BodyParameter("artist-id", "artist identifier").DataType("int")).
		Reads(PatronageRequest{}))
	return &ws
}