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

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

问题描述

所以我有这个网络应用程序使用angularJS和nodeJS。我不想用localhost来演示我的项目,因为当我键入node server.js,然后转到本地主机时,它看起来不是很酷。



由于我打算使用Firebase作为数据,所以我注意到Firebase提供了托管服务。我试了一下,但似乎只托管index.html而不是通过/使用server.js。我已经为服务器定制了使用/更新的文件。那么,如何告知Firebase主机在托管时使用我的服务器和相关文件呢?

是否有可能告诉Firebase,嘿,运行node server.js主机我的index.html?

解决方案

我猜你的方式你想看到这个网站的问题互联网



两条路线可以到这里。

b $ b a)通过Firebase托管服务您的索引。 Firebase只托管资产。如果您的Angular应用程序是通过Node服务的,那么您将需要将您的体系结构更改为SPA-ish SPA-ISH

SPA- ish 就像一个索引bootstrap,纯粹通过API与后端进行交互。



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天全站免登陆