如何處理像/用戶/路徑:ID和/用戶/:ID/HTTP中觸發火力地堡雲功能的訪問報告到PARAM ID?火力地堡雲功能路由
我不喜歡一個解決方案,因爲我的所有功能將是一個前綴/API的一部分:
const app = require('express')();
exports.api= functions.https.onRequest(app);
app.get('/user/:uid/report', (req, res) => {}):
但我需要類似的東西:
exports['/user/:uid/report'] = functions.https.onRequest((req, res) => {
// ...
});
我不認爲這是行得通的。 –
我的答案可行,您可以在網址中使用通配符,查看文檔https://firebase.google.com/docs/hosting/url-redirects-rewrites。 –
對不起,我以前的粗魯答案,根據文檔的URL是glob表示法,所以你可以在其中添加*。這裏是我的api在firebase雲funcitons中實現的一個例子https://jsfiddle.net/1x4crn9t/ –