29 lines
649 B
Go
29 lines
649 B
Go
package main
|
|
|
|
import (
|
|
"flag"
|
|
"log/slog"
|
|
"nats-app/internal/domains/sensors"
|
|
"nats-app/internal/iot"
|
|
)
|
|
|
|
func main() {
|
|
environment := flag.String("env", "dev", "dev or prod")
|
|
flag.Parse()
|
|
|
|
pool := iot.NewPGXPool("postgres://developer:secret@localhost:5432/nats-db?sslmode=disable")
|
|
|
|
iotDevice := iot.Start(*environment, "nats://localhost:4222")
|
|
|
|
repo := sensors.NewDecoratorRepo(pool)
|
|
sensorsService := sensors.NewService(repo)
|
|
_ = sensors.NewHandlers(sensorsService, iotDevice).SetupEndpoints()
|
|
|
|
slog.Debug("hello world debug")
|
|
slog.Info("Hello world info")
|
|
slog.Warn("Hello world warn")
|
|
slog.Error("hello world error")
|
|
|
|
select {}
|
|
}
|