I am encountering an issue while trying to use firebase functions to host my expressjs webapp. For some reason, all get parameters appear to be undefined. Can anyone help me figure out what the problem might be?
import functions= require("firebase-functions");
import admin= require("firebase-admin");
import express= require("express");
import bodyParser= require("body-parser");
const app: express.Application = express();
admin.initializeApp();
app.get("/getstory", async (req,resp)=>{
try{
const preferred_storyid=req.params.preferred_storyid;
console.log(`preferred_storyid ${preferred_storyid}`) //logs preferred_storyid undefined. Why?
resp.send("ok");
}catch (e) {
resp.send(`erequest_story. ${e}`);
}
});
const faststoryapi = functions.https.onRequest(app);
module.exports={faststoryapi}
After writing the code above, I deploy it using the command:
firebase deploy --only functions
I then send a GET request using Postman and encounter issues. You can view the screenshot https://i.sstatic.net/YChGg.png
PS: Another problem I have noticed is that I am unable to have more than one route. For example, having more than one post endpoint results in the second one not being called. How do you guys work around this limitation?