I am trying to connect to mongodb from my express app hosted on firebase dynamic hosting. I simply created an endpoint to save a data on mongodb. This endpoint can be called from localhost(works fine) but fails to load the page on firebase deploy(Error: could not handle the request)
const chris = new User({
name: 'john',
username: `test`,
password: `${Date.now()}`
});
app.get('/user', (request, response) => {
chris.save( (err) => {
if(err) {
response.send(`error occured`);
}
response.send(`${Date.now()}`);
});
});