Express-Node server on firebase, using functions.
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
firebase serve --only "functions,hosting"
firebase deploy
Using public, we can cache the content to Server, if we use private we can only store on user browser. max-age: How long we can cache the content on user browser. s-maxage: How long we can cache the content on server.
firebase functions:config:set someservice.key="THE API KEY" someservice.id="THE CLIENT ID"
To get, type in terminal
firebase functions:config:get
const functions = require('firebase-functions');
functions.config().someservice.id
const firebaseApp = firebase.initializeApp(functions.config().firebase);
Just make sure, when running server it's hosted on firebase or else you need the config copied to index or any file and used from there.
For more info on firebase config, please refer here https://firebase.google.com/docs/functions/config-env