Compare commits

..

No commits in common. "c0fea387908ca9db96d4b63968a3c9047d1c2260" and "0786a97a770c91bf9f7bdcce07046aac6368a607" have entirely different histories.

2 changed files with 2 additions and 21 deletions

View File

@ -58,7 +58,6 @@ func FooControllerHandler(ctx *framework.Context) error {
} }
func UserLoginController(ctx *framework.Context) error { func UserLoginController(ctx *framework.Context) error {
time.Sleep(10 * time.Second)
ctx.WriteJSON(http.StatusOK, "ok") ctx.WriteJSON(http.StatusOK, "ok")
return nil return nil
} }

22
main.go
View File

@ -1,13 +1,8 @@
package main package main
import ( import (
"context"
"fmt"
"log" "log"
"net/http" "net/http"
"os"
"os/signal"
"syscall"
"git.vinchent.xyz/vinchent/go-web/framework" "git.vinchent.xyz/vinchent/go-web/framework"
) )
@ -20,20 +15,7 @@ func main() {
Handler: core, Handler: core,
} }
go func() { if err := server.ListenAndServe(); err != nil {
server.ListenAndServe() log.Panic(err)
}()
// create quit channel
quit := make(chan os.Signal, 1)
// set notifier
signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT)
<-quit
fmt.Println("YOLO")
if err := server.Shutdown(context.Background()); err != nil {
log.Fatal("server shutdown: ", err)
} }
} }