Updated HttpServer in main.
This commit is contained in:
parent
804d46f14e
commit
f500cf945a
@ -117,20 +117,19 @@ func main() {
|
||||
r.Handler(http.MethodPatch, "/api/mindflow/category/:id", mindflowApi.EditCategory)
|
||||
r.Handler(http.MethodDelete, "/api/mindflow/category/:id", mindflowApi.DeleteCategory)
|
||||
|
||||
srv.POST("/api/mindflow-category", mindflowApi.NewCategory)
|
||||
srv.PATCH("/api/mindflow-category/:id", mindflowApi.EditCategory)
|
||||
srv.DELETE("/api/mindflow-category/:id", mindflowApi.DeleteCategory)
|
||||
srv := dwhttp.NewHttpServer(r)
|
||||
|
||||
if err := srv.Start(network, *listenAddress); err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
defer func() {
|
||||
if err := srv.Stop(); err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
}()
|
||||
|
||||
doneSignal := make(chan os.Signal, 1)
|
||||
signal.Notify(doneSignal, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)
|
||||
|
||||
<-doneSignal
|
||||
|
||||
if err := srv.Stop(); err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user