package main import ( "fmt" "log" "os" "github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2/middleware/cors" _ "github.com/mattn/go-sqlite3" "git.bhasher.com/bhasher/focus/backend/db" "git.bhasher.com/bhasher/focus/backend/handlers" ) func main() { driver := "sqlite3" port := "3000" connStr := os.Getenv("DB_PATH") if connStr == "" { connStr = "db.sqlite" } origins := "*" if err := db.InitDB(driver, connStr); err != nil { log.Fatal(err) } app := fiber.New() app.Use(cors.New(cors.Config{ AllowOrigins: origins, AllowMethods: "GET,POST,PUT,DELETE", AllowHeaders: "Origin, Content-Type, Accept", })) handlers.APIRouter(app.Group("/api")) log.Fatal(app.Listen(fmt.Sprintf(":%v", port))) }