It usually takes days to host a new app or readme
The time to set up a new dev project has gone from hours a few years ago to days now with the combination of node, NGINX, Python libs, apt-get, hosting services, dev environments, etc. One part that has always been a hidden challenge is getting your project live on the web and hosted in a way people can access it.
In the past, when most systems needed a direct apache / php server to host a site, the obvious answer was to boot one up. Now, with server-less one-page apps based on angular.js and react.js, it is no longer necessary (or a good idea) to host it on your own server as the SLA is much lower than on a huge hosting service. The only challenge is which one, how to set it up and how to create a deploy process for it.
GitHub Pages deploys in minutes
A little while ago, GitHub took their README.md files and started making them available on a sub-domain for each account such as:
Example of a readme: https://hcl337.github.io/ancilla/
What is really neat is that you can also host full web apps.
Example of a React app: https://hcl337.github.io/ancillawebclient/
How do you do this?
What they also allow is for you to point it at any web page in the branch of your repository. That means that you can point it to a react, angular or other starting page and it will load that website just like a readme file. Voila… free and simple hosting.
Here is the quick overview: https://pages.github.com/
A React tutorial is here which explains how to do it with ‘create-react-app’ from facebook. The simple implementation for hosting is to:
- Create a branch — they have ‘gh_pages’ as theirs.
- Set the GitHub Pages branch to ‘gh_pages’.
- Set up a build script which compiles the app and creates an index.html file as the core starting page with assets in a sub-directory. (See image below)
- Build/Deploy each time you want to deploy something.
Originally published at http://hansclee.blogspot.com on March 13, 2017.