package main import ( "context" "e621_to_neo4j/api" "e621_to_neo4j/database" neo4j "e621_to_neo4j/database/neo4j" "e621_to_neo4j/e621" "e621_to_neo4j/utils" "log" "net/http" "strings" ) func main() { var graphConnection database.GraphConnection ctx := context.Background() // Loads Config config, err := utils.LoadConfig() if err != nil { log.Println(err) } switch strings.ToLower(config.DBType) { case "neo4j": log.Println("Setup Neo4J Connection") graphConnection = neo4j.NewNeo4JConnection() err = graphConnection.Connect(ctx, config.DBEndpoint, config.Neo4jUsername, config.Neo4jPassword) if err != nil { panic(err) } log.Println("Connection successful") default: panic("No Database was selected!") } // 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, graphConnection, e621Client)) // Start the HTTP server err = http.ListenAndServe(":8080", nil) if err != nil { return } }