-
-
Save doyle-flutter/8970c926b6981143d0c59dcd4ce8e34d to your computer and use it in GitHub Desktop.
firebase data connect & expressjs - firebase admin
This file contains 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
const express = require('express'); | |
const app = express(); | |
const serviceAccount = require([path/file_name.json]); /// Firebase -> 프로젝트 설정 -> 서비스 계정 -> 비공개 키 생성 | |
const admin = require('firebase-admin'); | |
const { getDataConnect } = require('firebase-admin/data-connect'); | |
const firebaseApp = admin.initializeApp({credential: admin.credential.cert(serviceAccount)}); | |
const serviceId = "[Connect-ServiceID]"; // 영상 내 확인 | |
const location = "[LOCATION]"; // 영상 내 확인 | |
const dataConnect = getDataConnect({serviceId,location}); | |
app.listen(8000); | |
app.get("/", async (req,res) => { | |
const query = `query { | |
users { | |
id | |
uid | |
name | |
address | |
} | |
}`; | |
const connectData = await dataConnect.executeGraphqlRead(query); | |
res.json({connectData}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment