Host the Site & API On Cloudflare
Now that we've got an Astro generated site, we need to serve it to the world 🌏! We'll use Cloudflare Pages as our "server" and Workers as the API.
NOTE: Cloudflare has declared the week of November 14 to 21, 2021 "Full Stack Week" and has been pushing out an amazing list of new features and functionality.
Much of this presentation is not out of date (but not obsolete). Once if 🤔 the dust settles, I'll add more branches to discuss and demonstrate how the UPC Lookup service can take advantage of the new features.
Pages Hosts the Site
Since Pages was configured to monitor the repo on Github, as soon as any changes were made to the "main" or feature branches, Cloudflare generated the production site and preview URLs.
Original Version on "main"
Astro-ized Version
Final UPC Lookup App
Workers as an API
Cloudflare Workers acts as the API for the UPC Lookup app. As requests for UPC codes are received, it will query the very tiny UPC database (all 2 records) and respond with the product information. The only UPC codes stored are:
UPC Lookup Service API Source Code