github.com/blend/go-sdk@v1.20220411.3/examples/web/gzip_middleware/main.go (about) 1 /* 2 3 Copyright (c) 2022 - Present. Blend Labs, Inc. All rights reserved 4 Use of this source code is governed by a MIT license that can be found in the LICENSE file. 5 6 */ 7 8 package main 9 10 import ( 11 "os" 12 13 "github.com/blend/go-sdk/graceful" 14 "github.com/blend/go-sdk/logger" 15 "github.com/blend/go-sdk/web" 16 ) 17 18 func main() { 19 log := logger.Prod() 20 app := web.MustNew( 21 web.OptLog(log), 22 web.OptConfigFromEnv(), 23 web.OptUse(web.GZip), 24 ) 25 app.GET("/", func(_ *web.Ctx) web.Result { return web.Text.Result("OK!") }) 26 if err := graceful.Shutdown(app); err != nil { 27 log.Fatal(err) 28 os.Exit(1) 29 } 30 }