Friday, 26 May 2017

Does any npm for Node.js work with Cloud Functions for Firebase? And the folder structure

So I just watched a video (picture only here) from I/O 17 where "David the Googler" showed an example 22:50 minutes in. This example was exactly what I was looking for, but the code did NOT work when I tried uploading it to Firebase Hosting also using The Cloud Functions-feature.

What I tried was using expressJS (as showed in the video) to give the user the right page-content. Using "get()" to call a function and rewrite every link above "/" ("/**") in firebase.json to a function in Cloud Functions. I tried the "NewJS"-way and did not work, and I tried the regular JavaScript-way. I also added "express" to package.json.

I also want to send a specific file from the Hosting CDN. Preferably outside the default-named "public"-folder in Firebase Hosting. Is this possible? If I am going to use e.g. respons.status(200).sendFile(__dirname + "/_something_here_/user.html").



via RVNOR

No comments:

Post a Comment