I'm using Firebase to add auth to my site, and I want to export the user const into the express so I can pass it to a route. This is the function to create the user.
const signupForm = document.getElementById('signup');
if (signupForm) {
signupForm.addEventListener('submit', (e)=>{
e.preventDefault();
const email = signupForm.email.value;
const password = signupForm.password.value;
createUserWithEmailAndPassword(auth, email, password)
.then((cred)=>{
return cred.user;
})
signupForm.reset();
})
}
But when I require anything from the firebase file into express I keep getting this error
const signupForm = document.getElementById('signup'); ^ ReferenceError: document is not defined
I understand that the error is because document is DOM related and can't be run in express, but is there a way for me to export only the user const into express? any help is appreciated and thank you.