Slide 21
Slide 21 text
© DMM
goaによる自動生成とService,Methodの対応
21
- gen/
- search/
- service.go
- types.go
- http/
- search/
- client/
- client.go
- endpoint.go
- types.go
- server/
- server.go
- types.go
- openapi.json
- openapi.yaml
…
// API describes the global properties of the API server.
var _ = API("searchproxy-api
", func() {
…
Title("検索proxy-api
")
Description("検索APIのproxy
")
Server("app", func() {
Host("localhost", func() {
URI("http://localhost:8080
")
})
…
})
})
var searchResponse = Type("search_response ", func() {
Description ("search APIのレスポンス ")
Attribute("meta", Any, func() {
Meta("struct:field:type ", "json.RawMessage ", "encoding/json ")
Meta("struct:tag:json ", "meta,omitempty ")
})
…
var _ = Service("search", func() {
Method("search video contents
", func() {
Description("動画の検索API
")
Payload(searchPayload )
Result(searchResponse )
HTTP(func() {
GET("/video/contents
")
Response(StatusOK, func() { ContentType("application/json
") })
…
})
})
…
}
design/design.go
design/service/search.go
design/service/search.go