main
function
Show/Hide Function
Body
{
metaFlag := flag.Bool("meta", false, "generate OpenAPI JSON and exit")
flag.Parse()
if *metaFlag {
doc, err := swagger.Build("Example API", "1.0.0")
if err != nil {
fmt.Fprintf(os.Stderr, "swagger build error: %v\n", err)
os.Exit(1)
}
fmt.Println(string(doc))
os.Exit(0)
}
zapL, _ := zap.NewDevelopment()
defer zapL.Sync()
eng := http.NewFastHTTP()
lg := &logger.Zap{L: zapL}
router.New(
registry.Global(),
nil,
eng,
router.Options{
SessionDuration: 24 * time.Hour,
Logger: lg,
},
)
if err := eng.Serve(":8080"); err != nil {
lg.Fatal("server terminated", "err", err)
}
}