Last active
October 12, 2022 06:56
-
-
Save nidhi-canopas/6ef86f2ad4ee245e93f087a85a00ec59 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ctx := context.Background() | |
// configure database URL | |
conf := &firebase.Config{ | |
DatabaseURL: "https://fir-realtime-db-demo-xxxxx-default-rtdb.asia-southeast1.firebasedatabase.app", | |
} | |
// fetch service account key | |
opt := option.WithCredentialsFile("fir-realtime-db-demo-xxxxx-firebase-adminsdk-2zjoi-9b40ce1e42.json") | |
app, err := firebase.NewApp(ctx, conf, opt) | |
if err != nil { | |
log.Fatalln("error in initializing firebase app: ", err) | |
} | |
client, err := app.Database(ctx) | |
if err != nil { | |
log.Fatalln("error in creating firebase DB client: ", err) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment