[Dev] How are we using Surge to deploy our product pages

Recently, we've found an interesting service called Surge that makes shipping web static projects fast, easy and with low risk. As we needed to upload some static pages to talk about our products, we decided to try Surge and upload our Android App Page. And, well, we did it.

But, why are we using it and why do you should consider it? Because it has a lot of pros, to mention some:

  • Surge makes VERY easy to deliver a static webpage. Few seconds.
  • It's free (at least, the basic stuff. It has pricing for some extra things).
  • Surge take care of optimising the resources (Gzipping) and cleaning URLs (rewrite index.html to / , and hello-word.html to /hello-world)

Long story short. You don't have to worry about anything more than making a great static website. Even about the bill. And, well, nowadays that's absolutely fantastic.

So, how do you start playing with it?

mid

1 - You'll need node and npm installed on your computer. If you don't have it, you should first install it following the instructions from the official website.

2 - Install the command-line tool of surge by running the following command.

$ npm install --global surge

This will install surge as a global on your computer to use the executable on any directory you want.

3 - Now, go the directory of your project where your index.html resides.

$ cd projects/static-website
$ projects/static-website

4 - Execute surge.

$ projects/static-website surge

Resumed steps on a gif image from Surge: full

That will upload your static website to a subdomain on surge unless you specify another domain. And, for sure, you will want it. To do that you only have to specify a CNAME record to your domain (or subdomain) on your DNS Zone to na-west1.surge.sh. You can read more detailed instructions on Surge website.. On our case, we put the CNAME record to apps.hubii.com.

As you can see the process only takes a few seconds and the website is updated instantly. You can take a look to our first static website deployed using Surge: http://apps.hubii.com/android/