【发布时间】:2019-10-09 21:15:03
【问题描述】:
我正在使用 Firebase 托管 + 功能开发网络系统。 尽管在 firebase.json 上指定了重写规则, 部分路由不起作用。
root/
├ functions/
│ ├index.js
│ ├routes/
│ │ └ index.js
│ └views/
│ ├ index.jade
│ └ sub.jade
└ public/
└index.html // this is created by default. I don't want to use this.
这是我的 firebase.json
"rewrites": [{
"source": "**",
"function": "app"
}],
这是 node.js 代码。
router.get('/', function(req, res, next) {
res.render('index');
});
router.get('/subdir', function(req, res, next) {
res.render('sub');
});
结果
https://myurl/ -> public/index.html is shown.(not handled on node.js)
https://myurl/ -> handled on node.js
你知道如何在 firebase 主机上使用 node.js 处理根路径请求吗?
【问题讨论】:
标签: firebase google-cloud-functions firebase-hosting