Skip to content

irubnich/hmiafb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HOW MUCH IS A FUCKING BITCOIN?

Wouldn't you like to know.

This is the repo for this website.

Develop

  1. Clone the repo:
git clone [email protected]:irubnich/hmiafb.git
cd hmiafb
  1. Install Netlify CLI and dependencies:
yarn global add netlify-cli
yarn install
  1. Run the dev server:
netlify dev
  1. Open localhost:8888
  2. Enjoy?

Deploy

  1. Build the site:
yarn build
  1. Deploy the build folder to any static host your heart desires

How it Works

  1. A bunch of React components render the data-less skeleton of the page. Check out src/components/layout.tsx and src/App.tsx for that skeleton.
  2. The Price component fires a request to get BTC exchange rates to a Netlify Function. The function's source is in functions/get-rates.js.
  3. The cloud function calls the Coinbase API to get that sweet BTC data it so craves. This request proxying is needed because of browser-enforced CORS restrictions.
  4. The response is parsed and the Price component's state is updated with the new exchange rate and more importantly a new expletive. It defaults to USD because America. 🇺🇸 🦅
  5. The view is tied to the state so everything magically updates. Thanks React!

Steps 2-5 run every 30 seconds (you may have noticed that BTC fluctuates a lot) or whenever a new currency is selected.


Made by Ilya

About

GIVE THE PEOPLE WHAT THEY WANT

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published