Created
June 13, 2019 00:28
-
-
Save ikawaha/7317274ea5bbf0dd2d51c22cf6240b28 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package design | |
import ( | |
. "goa.design/goa/v3/dsl" | |
cors "goa.design/plugins/v3/cors/dsl" | |
) | |
var _ = API("calc", func() { | |
Title("Calculator Service") | |
Description("Service for adding numbers, a Goa teaser") | |
Server("calc", func() { | |
Host("localhost", func() { | |
URI("http://localhost:8000") | |
URI("grpc://localhost:8080") | |
}) | |
}) | |
cors.Origin("/.*localhost.*/", func() { | |
cors.Headers("Content-Type", "api_key", "Authorization") | |
cors.Methods("GET", "POST", "DELETE", "PUT", "PATCH", "OPTIONS") | |
cors.MaxAge(600) | |
}) | |
}) | |
var _ = Service("calc", func() { | |
Description("The calc service performs operations on numbers.") | |
Method("add", func() { | |
Payload(func() { | |
Field(1, "a", Int, "Left operand") | |
Field(2, "b", Int, "Right operand") | |
Required("a", "b") | |
}) | |
Result(Int) | |
HTTP(func() { | |
GET("/add/{a}/{b}") | |
}) | |
GRPC(func() { | |
}) | |
}) | |
}) | |
var _ = Service("calc2", func() { | |
Description("The calc service performs operations on numbers.") | |
Method("add2", func() { | |
Payload(func() { | |
Field(1, "a", Int, "Left operand") | |
Field(2, "b", Int, "Right operand") | |
Required("a", "b") | |
}) | |
Result(Int) | |
HTTP(func() { | |
GET("/add2/{a}/{b}") | |
}) | |
GRPC(func() { | |
}) | |
}) | |
}) | |
var _ = Service("swagger", func(){ | |
Files("/openapi.json", "./gen/http/openapi.json", func(){ | |
Meta("swagger:generate", "false") | |
}) | |
}) |
Author
ikawaha
commented
Jun 13, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment