httpNick
httpNick

Reputation: 2624

Hosting my MEAN stack web app on github pages

I have a project here that is on github. I created a gh-pages branch to make it hosted on github pages. The link they gave me to my hosted site is here.

I am pretty new to web apps and especially new to MEAN stack web apps. My question is - how can I access my web app now that it is hosted via github? Obviously the hosted link gives a 404 error because I don't have an index.html file in the root of the project. The "html" I have in the project is in the views folder and has an "ejs" file extension (index.ejs).

To run this app on my local machine I start an npm server:

npm start

Then I navigate to http://localhost:3000/#/home in a browser to see the app.

Is it even possible to host this app on github pages? Do I need to modify my project in some way to make it work? Also - I know I will have to change the mongoose database pointer for the database portion to work. Any pointers in the right direction would be greatly appreciated!

Upvotes: 6

Views: 6318

Answers (2)

Razat Patkar
Razat Patkar

Reputation: 91

If you want to host a it on GitHub pages you can follow these steps:

  1. Separate Angular front end with node back end API.
  2. Host your Angular front end to GitHub pages.
  3. Then host your node back end to some cloud hosting. Make sure you have CORS enabled. It will work as a REST API.
  4. Now use the REST API end points to wire up the the whole app.

Upvotes: 8

Adam Gent
Adam Gent

Reputation: 49095

Github does not host nodejs instances.

Upvotes: 9

Related Questions