使用 firebase 托管 nodeJS 应用程序 [英] Hosting nodeJS app with firebase

查看:30
本文介绍了使用 firebase 托管 nodeJS 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有这个使用 angularJS 和 nodeJS 的网络应用程序.我不想只使用 localhost 来演示我的项目,因为当我键入node server.js"然后转到 localhost.....

由于我打算将 Firebase 用于数据,因此我注意到 Firebase 提供托管.我试过了,但它似乎只托管 index.html 而不是通过/使用 server.js.我已经为服务器定制了文件来使用/更新.那么,如何让 Firebase 托管在托管时使用我的服务器和相关文件?

是否可以告诉 Firebase,嘿,运行node server.js"来托管我的 index.html?

解决方案

我猜你的措辞是你想从互联网"看到这个网站的问题.>

这里有两条路线可以走.

a) 通过 Firebase 托管为您的索引提供服务.Firebase 仅托管资产.如果您的 Angular 应用程序是通过 Node 提供服务的,那么您需要将架构更改为更SPA-ish

SPA-ish 就像一个索引引导程序,完全通过 API 与后端交互.

您可以将 API 服务器托管在更合适的地方,例如通过 Nodejitsu.

b) 通过 Nodejitsu(托管平台)或由 BuyVM.net 等不同类型托管公司管理的您自己的虚拟机来提供整个服务.

So I have this web-app using angularJS and nodeJS. I don't want to just use localhost to demo my project because it doesn't looks cool at all when I type "node server.js" and then go to localhost.....

Since I intend to use Firebase for the data, I have noticed that Firebase provides hosting. I tried it, but it seems to only host the index.html and not through/using server.js. I have customized files for the server to use/update. So, how can I tell Firebase Hosting to use my server and related files when hosting?

Is it possible to tell Firebase, hey, run "node server.js" to host my index.html?

解决方案

I'm guessing by the way you are wording the question you want to see this site from "the internet".

Two routes you could go here.

a) Serve your index through Firebase hosting. Firebase only hosts assets. If your Angular app is being served through Node then you will need to change your architecture to be more SPA-ish

SPA-ish would be like an index bootstrap that interacts with the backend purely through API's.

You would host the API server on something more appropriate like through Nodejitsu.

b) Serve the whole thing through something like Nodejitsu (hosting platform) or your very own VM managed by a different kind of hosting company like BuyVM.net.

这篇关于使用 firebase 托管 nodeJS 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆