Created
October 13, 2019 12:14
-
-
Save luandevpro/b524574d5228de7bcdb46df843c51492 to your computer and use it in GitHub Desktop.
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
import * as admin from 'firebase-admin'; | |
const serviceAccount = require('./serviceAccountKey.json'); | |
try { | |
admin.initializeApp({ | |
credential: admin.credential.cert(serviceAccount), | |
databaseURL: 'https://nextjs-graphql-firebase-redux.firebaseio.com', | |
}); | |
} catch (err) { | |
console.log('firebase initializeApp'); | |
} | |
const withFirebase = (handle) => (req, res) => { | |
req.admin = admin; | |
return handle(req, res); | |
}; | |
export default withFirebase; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment