-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
39 lines (30 loc) · 822 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package main
import (
"log"
"os"
"github.com/petr-hanzl/chatwithme/internal/db"
"github.com/petr-hanzl/chatwithme/internal/handler"
"github.com/petr-hanzl/chatwithme/internal/logger"
"github.com/petr-hanzl/chatwithme/internal/middleware"
"github.com/joho/godotenv"
"github.com/labstack/echo/v4"
)
func main() {
err := godotenv.Load()
if err != nil {
panic(err)
}
os.Getenv("OPENAI_API_TOKEN")
database, err := db.MakeDb()
if err != nil {
panic(err)
}
app := echo.New()
app.Use(middleware.Logger(logger.NewLogger("DEBUG", "Logger Middleware")))
chatHandler := handler.NewChatHandler(db.MakeChatController(database))
// API
apiGroup := app.Group("/api/v1")
chatGroup := apiGroup.Group("/chat")
chatGroup.POST("/:personaId", chatHandler.PersonaPostHandler)
log.Fatal(app.Start(":4000"))
}