How to publish a static web using Surge?

Anjula Shanaka
Webtips
Published in
2 min readDec 27, 2020

As a front-end developer have you ever wondered how to deploy a web project and get things like clean URLs, graceful trailing slash handling, fallback 404 pages, or serve a catch-all file for apps using PushState?

Surge does all that while handling details such as setting long–live cache headers and setting proper HTTP status codes across a content delivery network.

Let me demonstrate how to get started with surge using an example,

Get Started

To get started with surge is easy. Just install using npm and then run surge within any directory you wish to publish onto the web.

  1. install the latest version of NodeJS
  2. install using npm by running npm install -g surge

npm install -g surge

3. run surge from within any directory to publish that directory onto the web.

running surge

That’s it! Account creation will happen on the first run and you may deploy as frequently as you like.

Every project on Surge comes with…

This is a small introduction about the surge static web deployment. Don’t forget to go through the documentation to get a better idea. I hope you liked it don’t forget to read my previous blog articles. Until the next one, Stay safe! ✌️

References:

[1]. Surge.[2020] Getting Started[Online]. Available at: https://surge.sh/help/getting-started-with-surge [Accessed 27 December 2020]

--

--

Anjula Shanaka
Webtips

GSoC ’22 @openMRS | CTO @SEF | Developer @promiseQ | Undergraduate @USJ