Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase Hosting with own server node.js

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?

like image 441
jul56 Avatar asked May 11 '15 15:05

jul56


People also ask

Does Firebase hosting support Nodejs?

Firebase Hosting supports a REST API for advanced developers to build custom workflows, like deploying through a JavaScript app. We also have a Node. js module which you can import into your Node. js apps to build advanced functionality.

Can you host server on Firebase?

Firebase Hosting supports all kinds of content for hosting, from your CSS and HTML files to your Express. js microservices or APIs. Each file that you upload is cached on SSDs at CDN edges around the world and served as gzip or Brotli.


4 Answers

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.

like image 92
iforgotmypassword Avatar answered Oct 08 '22 02:10

iforgotmypassword


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.

like image 41
Frank van Puffelen Avatar answered Oct 08 '22 02:10

Frank van Puffelen


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.

like image 20
Daniel Murawsky Avatar answered Oct 08 '22 03:10

Daniel Murawsky


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

like image 26
Linh Le Vu Avatar answered Oct 08 '22 02:10

Linh Le Vu