planner/main.go

28 lines
469 B
Go
Raw Normal View History

2024-07-26 13:37:21 +02:00
package main
2024-08-21 16:35:44 +02:00
import (
2024-08-28 07:21:02 +02:00
"log/slog"
2024-08-21 16:35:44 +02:00
"net/http"
2024-08-28 07:21:02 +02:00
"os"
"os/signal"
"syscall"
2024-08-21 16:35:44 +02:00
"code.ewintr.nl/planner/handler"
"code.ewintr.nl/planner/storage"
)
2024-07-26 13:37:21 +02:00
func main() {
2024-08-21 16:35:44 +02:00
mem := storage.NewMemory()
2024-08-28 07:21:02 +02:00
logger := slog.New(slog.NewJSONHandler(os.Stdout, nil))
2024-08-21 16:35:44 +02:00
2024-08-28 07:21:02 +02:00
go http.ListenAndServe(":8092", handler.NewServer(mem, logger))
2024-08-21 16:35:44 +02:00
2024-08-28 07:21:02 +02:00
logger.Info("service started")
c := make(chan os.Signal, 1)
signal.Notify(c, syscall.SIGINT, syscall.SIGTERM)
<-c
logger.Info("service stopped")
2024-07-26 13:37:21 +02:00
}