Wouldn't you like to know.
This is the repo for this website.
- Clone the repo:
git clone [email protected]:irubnich/hmiafb.git
cd hmiafb
- Install Netlify CLI and dependencies:
yarn global add netlify-cli
yarn install
- Run the dev server:
netlify dev
- Open localhost:8888
- Enjoy?
- Build the site:
yarn build
- Deploy the
build
folder to any static host your heart desires
- A bunch of React components render the data-less skeleton of the page. Check out
src/components/layout.tsx
andsrc/App.tsx
for that skeleton. - The
Price
component fires a request to get BTC exchange rates to a Netlify Function. The function's source is infunctions/get-rates.js
. - 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.
- 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. 🇺🇸 🦅 - 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