Reputation:
I know the path directory is the right path, it's just that I always get the error 'Error: ENOENT: no such file or directory, stat '/public/resetp.html'
My paths are as follows:
index.js: firebase/functions/index.js
reset password.html: firebase/public/resetp.html
When I go to this endpoint on my function on my website it runs this code:
response.sendFile(path.join(__dirname, '/./public/resetp.html'));
I need to use the sendFile() function so that I can just render the html file and not change the URL since in the html file that I'm trying to load, it gets the parameters of the URL (like the action code) and gets the users input to reset the users password.
Thanks, Nathan
Upvotes: 1
Views: 1036
Reputation: 26313
You can achieve this by making your public
directory inside your functions
directory:
{
"hosting": {"public": "functions/public"}
}
All of the files in your functions
directory are deployed with Cloud Functions, and no files outside of it are available.
Warning: The files that will be available will be whatever files are in the public directory at the time you deploy Cloud Functions. It is up to you to make sure Hosting and functions deploys are kept in sync.
Upvotes: 2