Skip to content

bryancheny/convert-currency-rates

Repository files navigation

Currency Converter

This is a responsive currency converter website which fetches data daily from an external API. The page is pre-rendered at build time and a cached static page is shown to visitors. The site is rebuilt using IFTTT to visit Netlify's API endpoint everyday at 8.15am. (Unfortunately Netlify doesn't support Next.js's On-demand Incremental Static Regeneration yet) This is done because the external API itself only updates daily, using the free tier anyway. Built with Next.js, React and React-Bootstrap.

image

Build from Source

After cloning the repo, open .env and set REACT_APP_API_KEY to be your API key. Set NEXT_REVALIDATE_TOKEN to be whatever password you want.

Using npm 8.1.2,
npm install
Then run

npm run build
npm run start

Open the server at http://localhost:3000/

To purge the cache and force-update the page, visit http://localhost:3000/api/revalidate?secret=yourpassword, where yourpassword is what you set NEXT_REVALIDATE_TOKEN to earlier. You can then use IFTTT to schedule webhook requests to that API endpoint.

If you are deploying to netlify this won't work though because netlify doesn't support it. In that case you should let IFTTT visit Netlify's build hook to rebuild the site.

Releases

No releases published

Packages

No packages published

Languages