package main import ( "context" "e621_to_neo4j/api" "e621_to_neo4j/e621" "e621_to_neo4j/neo4jAPI" "e621_to_neo4j/utils" "github.com/neo4j/neo4j-go-driver/v5/neo4j" "log" "net/http" ) func main() { // Loads Config config, err := utils.LoadConfig() if err != nil { log.Println(err) } // Connect to Neo4j DB driver, err := neo4jAPI.NewConnection(config.Neo4jURL, config.Neo4jUsername, config.Neo4jPassword) if err != nil { log.Fatal(err) } ctx := context.Background() defer func(driver neo4j.DriverWithContext, ctx context.Context) { err := driver.Close(ctx) if err != nil { log.Fatal(err) } }(driver, ctx) // Initialize the e621API e621Client := e621.NewClient(config.E621APIKey, config.E621Username) log.Printf("Im ready!") // Register the UserHandler with the "/user" route http.HandleFunc("/user", api.UserHandler(ctx, driver, e621Client)) // Start the HTTP server err = http.ListenAndServe(":8080", nil) if err != nil { return } }