Firebase Hosting with own server node.js

安稳与你 提交于 2020-01-20 03:09:01

问题


I have webapp with firebase database. I would like hosting the app on firebase. My app has own server nodejs and using websockets. How can I host my app on Firebase? And how can I run my own server on Firebase?


回答1:


I think your question is quite simple. And the answer is also simple: no, you can't.

Firebase only serves static files. You need to try heroku, codeship, etc for that.




回答2:


I'm not sure what exactly you are looking for. I'll assume it's one of these two:

  1. you want to run the node.js scripts on Firebase's server

    There is no way to run your own code on Firebase's servers.

  2. you want to run the node.js scripts on your own server and have them interact with your Firebase data

    Firebase has a node.js package that allows you to talk to its BaaS service from your own node scripts. See the node.js section in Firebase's quickstart and the npm package for Firebase.




回答3:


You can use Google Cloud Functions to do most task processing in a serverless style: https://firebase.google.com/docs/hosting/functions

I'm using it to dynamically load javascript based on req.url.




回答4:


With Firebase functions, yes you can. You can watch this tutorial from Google, it's very clear and easy to catch up. Node.js apps on Firebase Hosting Crash Course - Firecasts




回答5:


Firebase Hosting allows you to use Cloud Functions to perform server-side processing. This means that you can support dynamic generation of content for your Firebase Hosting site.

Documentation



来源:https://stackoverflow.com/questions/30172320/firebase-hosting-with-own-server-node-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!