MCPcopy Create free account
hub / github.com/goadesign/goa / DefaultServer

Method DefaultServer

expr/api.go:151–166  ·  view source on GitHub ↗

DefaultServer returns a server expression that describes a server which exposes all the services in the design and listens on localhost port 80 for HTTP requests and port 8080 for gRPC requests.

()

Source from the content-addressed store, hash-verified

149// exposes all the services in the design and listens on localhost port 80 for
150// HTTP requests and port 8080 for gRPC requests.
151func (a *APIExpr) DefaultServer() *ServerExpr {
152 svcs := make([]string, len(Root.Services))
153 for i, svc := range Root.Services {
154 svcs[i] = svc.Name
155 }
156 return &ServerExpr{
157 Name: a.Name,
158 Description: "Default server for " + a.Name,
159 Services: svcs,
160 Hosts: []*HostExpr{{
161 Name: "localhost",
162 ServerName: a.Name,
163 URIs: []URIExpr{URIExpr("http://localhost:80"), URIExpr("grpc://localhost:8080")},
164 }},
165 }
166}
167
168// EvalName is the qualified name of the expression.
169func (a *APIExpr) EvalName() string { return "API " + a.Name }

Callers 6

FinalizeMethod · 0.95
FinalizeMethod · 0.80
ResetDSLFunction · 0.80
runDSLFunction · 0.80
RunDSLFunction · 0.80
initDSLFunction · 0.80

Calls 1

URIExprTypeAlias · 0.85

Tested by 1

runDSLFunction · 0.64