Easily Deploy Static Websites with Surge, Easily

Scottie Crump
Aug 28, 2017 · 2 min read

I recently came across a great tool to have in your tool belt. If you are a web developer wanting to deploy your static web projects online for the world to see, you need a way to complete this task. Keep in mind we’re talking about static projects, meaning projects where pages are not created dynamically by a server side language like NodeJS or Java for example.

You may be familiar using Github Pages or Amazon Web Services for example to achieve this. There is an easier way. We can use a simple tool called Surge to deploy your project folder in seconds using the command line interface (CLI). Did I mention this is easier?


Here are the basic commands to deploy projects using surge:

To install the surge cli use: npm install -g surge

When you’re ready to deploy your project navigate to the directory to deploy and use: surge via the cli. You will be prompted to create an account with an email and password, so that only you can deploy to the specific domain for your project.

If you want to update and re-deploy your surge project just use:

surge --domain yourProjectDomain.sh inside the project directory.

You can also create a CNAME file in the root of your project with your domain name saved in it (i.e. myDomain.surge.sh), so surge will automatically look there to find your domain name when you run the surge command.

If you want to delete a surge project use:

surge teardown yourProjectDomain.surge.sh

If you’re more of a visual learning like myself, here is a video illustrating the basic commands of using surge.

Oh, If you have your own custom domain, you can use it instead of what surge provides. There are other features of surge that you can easily find in their documentation. So that’s it! You’ve been surged.

)

Scottie Crump

Written by

A teacher, coder, and loves to learn

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade