Giter Site home page Giter Site logo

html-time's Introduction

HTML-TIME

https://setyourwatchby.netlify.com

A ludicrous experiment triggered by a playful tweet:

free side project idea: HTML-only static site generated clock that deploys a new version to @netlify every minute โ€“ @zachleat

What does it do?

  • Server-side, an Edge Function determines the user's location based on their IP address and modifies the returned HTML to display the correct local time.
  • That's all.

Previously

In its original form, it demonstrated something slightly different:

  • It built a page with the local time for a variety of timezones. (correct at build time.)
  • When served on Netlify's global CDN, visitors were routed to the correct page for them based on the country they access from.

That was then, this is now

Prompted by that idea by Zach, I made this site as a demonstration of how frictionless and risk-free regular automated deployments could be. It automatically redeployed every minute of every day. It has been a helpful resource for demonstrations. But as the site shows, time moves on.

Edge Handlers have brought an easier and less wasteful way to do this. By modifying HTTP responses on the fly to provide dynamic content, we don't need to redeploy every minute to make a server-generated clock! And the likes of Netlify's CI/CD and automated deploys have become far more accepted as the norm, so there is less need to make this point.

Localised and modified on demand

Now the time you see on this site has been rendered on demand by an Edge Function. Edge Functions offer a very low latency serverless runtime at a location on the CDN geographically close to the requesting user. Very handy and still without the need to manage and maintain a server. It's just a function.

I miss the old way

Me too. It was a bit of fun. But it was wasteful to keep it alive forever for a demo.

What on earth for?

Since we can run this build so regularly and with such confidence on Netlify, we rebuild and deploy automatically every minute.

Are you an idiot?

Possibly. But it turns out that this is a nice example of how the country-specific CDN routing is on Netlify thanks to its concise, yet powerful _redirects API. (docs)

Have a poke around!

Developing locally

First ensure that you have the Netlify CLI installed to provide local development and testing of Edge Functions

# Install the Netlify CLI
npm i -g netlify-cli
# clone this repository
git clone [email protected]:philhawksworth/html-time.git

# move into the project and install the dependencies
cd html-time
npm i

# run a local development server with auto-rebuild and hot reloading
ntl dev

Deployed to Netlify

Netlify Status

html-time's People

Contributors

cirkut avatar dependabot[bot] avatar imaman avatar jacokoster avatar jimniels avatar lauragift21 avatar nirantak avatar philhawksworth avatar seralichtenhahn avatar tomaszczechowski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

html-time's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.