NOTE: This tutorials setup Firebase Functions without Firebase Hosting. If you wanted both, refer to Setup Firebase Hosting and Functions (Node).
Install Firebase CLI
npm install -g firebase-toolsSetup Firebase CLI
firebase loginCreate project directory.
mkdir PROJECTcd PROJECTSetup Cloud Functions
firebase init functionsWhat language would you like to use to write Cloud Functions? JavaScript
? Do you want to use ESLint to catch probable bugs and enforce style? No
✔ Wrote functions/package.json
✔ Wrote functions/index.js
✔ Wrote functions/.gitignore
? Do you want to install dependencies with npm now? YesCreate Cloud Functions
cd functionsEdit index.js.
const functions = require('firebase-functions');exports.hello = functions.https.onRequest(async (request, response) => { const name = request.query.name; response.send(`Hello ${name}`)})Test Local Development
npm run serveAccess: http://localhost:5000/PROJECT/us-central1/hello?name=Desmond
Deploy
npm run deployor
firebase deploy --only functionsDeploy specific functions only
firebase deploy --only functions:helloReferences: