-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.go
45 lines (35 loc) · 1.05 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//go:generate goagen bootstrap -d github.com/goadesign/swagger-service/design
package main
import (
"net/http"
"os"
"google.golang.org/appengine"
"github.com/goadesign/goa"
"github.com/goadesign/goa/logging/log15"
"github.com/goadesign/goa/middleware"
"github.com/goadesign/swagger-service/app"
"github.com/inconshreveable/log15"
)
func main() {
// Configure logger
logger := log15.New()
logger.SetHandler(log15.StreamHandler(os.Stderr, log15.LogfmtFormat()))
// Create service
service := goa.New("goa Swagger service")
service.WithLogger(goalog15.New(logger))
// Setup middleware
service.Use(middleware.RequestID())
service.Use(middleware.LogRequest(true))
service.Use(middleware.ErrorHandler(service, true))
service.Use(middleware.Recover())
// Mount "spec" controller
c := NewSpecController(service)
app.MountSpecController(service, c)
// Mount "ae" controller
h := NewAeController(service)
app.MountAeController(service, h)
// Start service, listen on port 8080
http.Handle("/", service.Mux)
appengine.Main()
logger.Info("Exiting...")
}