20 thoughts on “Hosting on Firebase – Firebase – Rest endpoints with express

  1. Please use "rewrites": "source": "**" instead, it will automatically work for /home, /second, and any other url. Full code below:

    {
    "functions": {
    "predeploy": [
    "npm –prefix "$RESOURCE_DIR" run lint"
    ]
    },
    "hosting": {
    "public": "public",
    "ignore": [
    "firebase.json",
    "**/.*",
    "**/node_modules/**"
    ],
    "rewrites": [
    {
    "source": "**",
    "function": "app"
    }
    ]
    },
    "storage": {
    "rules": "storage.rules"
    }
    }

  2. This is a bit old, but when I use the deploy, only the first function works (/home), the other still keeps getting the same error you did, but I tried to fix already (watched the entire video)…
    const functions = require('firebase-functions');

    const express = require('express');

    const app = express();

    app.get('/home', (request:any, response:any) => {

    response.send('Hello firestore fuckers');

    });

    app.get('/secondhome', (request:any, response:any) => {

    response.send('Hello firestore ');

    });

    exports.app = functions.https.onRequest(app);

    "hosting": {

    "public": "public",

    "rewrites": [

    {

    "source": "/home",

    "function": "app"

    },

    {

    "source": "/secondhome",

    "function": "app"

    }

    ],

    "ignore": [

    "firebase.json",

    "**/.*",

    "**/node_modules/**"

    ]

    }

  3. Thanks Raja for this useful tutorial. Can you give a simple example, or point me to an example, of how to create or update a Firebase record, instead of the response.send('hello etc etc')? Also, if I may ask, how powerful is the Firebase query language? Can I do things like select where field = some value, or do aggregate operations such as sum etc? Thanks again for this helpful video.

  4. Raja Yogan can you show us how to integrate and work with firebase cloud functions in ionic. Example like notifying order or messages between 2 users device based on firebase db data realtime changes? It will be helpful for beginners like me and others in ionic.

    Example, similar concept like ola and uber app, when user start book, the driver will get notified to accept right away on their app. Im looking to learn how to build similar concept in ionic with firebase cloud functions. You will find example that im trying to achieve here –> This is what exactly im looking for https://www.youtube.com/watch?v=mmao_xt6-KQ&feature=youtu.be&t=5m19s

    Thanks with hope that you will teach us.

Leave a Reply

Your email address will not be published. Required fields are marked *