9ca1f39f75
I couldn't find an example when creating an SSR page using firebase's firestore data, so I improved the example based on the actual app I created My sample app: https://github.com/mikan3rd/commitly
14 lines
422 B
JavaScript
14 lines
422 B
JavaScript
import * as admin from 'firebase-admin'
|
|
|
|
if (!admin.apps.length) {
|
|
admin.initializeApp({
|
|
credential: admin.credential.cert({
|
|
projectId: process.env.NEXT_PUBLIC_FIREBASE_PROJECT_ID,
|
|
clientEmail: process.env.FIREBASE_CLIENT_EMAIL,
|
|
privateKey: process.env.FIREBASE_PRIVATE_KEY.replace(/\\n/g, '\n'),
|
|
}),
|
|
databaseURL: process.env.NEXT_PUBLIC_FIREBASE_DATABASE_URL,
|
|
})
|
|
}
|
|
|
|
export default admin
|