How can I have a function that runs only once, server side, when the server is first built?
Unanswered
Sun bear posted this in #help-forum
Sun bearOP
I want to use the admin fireauth sdk to do authentification on the server side, so that my serverSideProps can know about what user is currently authentificated (if there's an easier way to achieve this please let me know, I'm new).
To use fireauth, I need to initialize the admin fireauth object exactly once. This looks like this:
So I need this function to run server side exactly once. How can I do this?
To use fireauth, I need to initialize the admin fireauth object exactly once. This looks like this:
function initFirebaseAdmin() {
admin.initializeApp({credential:admin.credential.cert(serviceAccount as string|ServiceAccount)})
}
export default initFirebaseAdminSo I need this function to run server side exactly once. How can I do this?