doomer/main.go

27 lines
383 B
Go
Raw Normal View History

2022-12-04 17:30:08 +03:00
package main
import (
"log"
2022-12-06 00:57:09 +03:00
"nefrace.ru/doomer/config"
2022-12-06 02:04:05 +03:00
"nefrace.ru/doomer/db"
2022-12-04 17:30:08 +03:00
)
func main() {
2022-12-06 02:04:05 +03:00
config.InitConfig()
db, err := db.NewDatabase()
2022-12-04 17:30:08 +03:00
if err != nil {
log.Fatalf("Cant open database: %v", err)
}
2022-12-06 00:57:09 +03:00
2022-12-04 17:30:08 +03:00
defer db.Close()
2022-12-06 00:57:09 +03:00
doomer := NewDoomer(db)
dp := NewDispatcher(doomer)
2022-12-06 02:04:05 +03:00
app := InitServer(":3000")
2022-12-04 17:30:08 +03:00
go func() {
2022-12-06 02:04:05 +03:00
log.Fatal(app.Run())
2022-12-04 17:30:08 +03:00
}()
log.Println(dp.Poll())
}