Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hosting nodeJS app with firebase

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?

like image 988
Bones and Teeth Avatar asked Oct 29 '14 03:10

Bones and Teeth


People also ask

Can I host Nodejs app on Firebase?

You can now run firebase deploy --only functions and wait for the process to finish. You can click on the address that looks like this : https://us-central1-host-nodejs-app.cloudfunctions.net/app/dogs and your route will appear !

Can I host Mern app on Firebase?

However, if you are building this MERN app just to include in your Portfolio or for learning purposes. Go for hosting services like firebase or Github pages which are relatively easier to work with. Choose your hosting environment wisely, also make sure you are not paying for something you don't want.

Can Firebase host a backend?

In your local project directory, you can also set up Cloud Functions or Cloud Run for your dynamic content and microservices. Run firebase emulators:start to emulate Hosting and your backend project resources at a locally hosted URL.

How to add firebase to Node JS project?

Go to firebase console Create your firebase project and then fill the required field If your project successfully created, you will be directed to firebase project overview. Click on hosting menu,there will be a command to add firebase on your node js project. Now we will run some command to start our firebase project via terminal

What do I need to run a firebase app?

You’ll need a Node.js environment to write functions, and you’ll need the Firebase CLI to deploy functions to the Cloud Functions runtime. For installing Node.js and npm, Node Version Manager is recommended. How do I host an app on Firebase? Before you can set up Firebase Hosting, you need to create a Firebase project.

What is Firebase Hosting and Cloud Functions?

Hosting static and dynamic apps with Node.js as backend with Firebase Hosting and Cloud Functions — for free! What is Firebase? Google’s server platform Firebase offers a lot — not only hosting a custom backend with Node.js, but also all the parts you need for a fullstack project, like databases, file hosting, authentication & much more.

What is the best hosting service for Node JS?

If you’re looking for a hosting to deploy Node.js project, maybe you can consider choosing a hosting service at firebase. Firebase provide hosting static fast and secure for web applications. Some of the major capabilities of this hosting are:


1 Answers

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.

like image 181
Dan Kanze Avatar answered Oct 03 '22 05:10

Dan Kanze