github.com/blend/go-sdk@v1.20220411.3/examples/web/no_content/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 "fmt" 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 app := web.MustNew(web.OptLog(logger.All())) 20 21 app.GET("/204", func(_ *web.Ctx) web.Result { 22 return web.NoContent 23 }) 24 app.GET("/500", func(_ *web.Ctx) web.Result { 25 return web.JSON.InternalError(fmt.Errorf("this is only a test")) 26 }) 27 28 if err := graceful.Shutdown(app); err != nil { 29 logger.FatalExit(err) 30 } 31 }