Skip to content

Instantly share code, notes, and snippets.

@brurucy
Last active February 9, 2023 21:31
Show Gist options
  • Save brurucy/fffd9d47c1ff04ab1bea59c828cc1073 to your computer and use it in GitHub Desktop.
Save brurucy/fffd9d47c1ff04ab1bea59c828cc1073 to your computer and use it in GitHub Desktop.
memoir
func main() {
log := logger.New(verbose)
if err != nil { … }
rawSchemata, err := os.ReadFile(SCHEMATA_LOCATION)
if err != nil { … }
schemata := schema.Schemata{}
if err = yaml.Unmarshal(rawSchemata, &schemata); err != nil { … }
app := gin.New()
server.AddRoutes(app, git.New(), memfs.New(), schemata, log)
srv := &http.Server{
Addr: ":3000",
Handler: app,
}
go func() {if err = srv.ListenAndServe(); err != nil && errors.Is(err, http.ErrServerClosed) {..}}()
ctx, cancel := context.WithTimeout(context.Background(), GRACEFUL_SHUTDOWN_TIMEOUT)
defer cancel()
serv := server.New(srv)
quitter := make(chan os.Signal)
server.StartGracefulShutdownWatcher(ctx, serv, log, quitter)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment