A minimalist Cloudflare Worker to display an interactive synthesizer during maintenance. Just copy the contents of underconstruction.js
into a new Worker and you're good to go.
- 9 Pads: Play any chords from your MIDI file (example uses Crystal Waters' "She's Homeless").
- Browser-Based: Playback and synthesis happen directly in the browser with no dependencies.
- Mobile Friendly: Works on mobile devices.
- Create a new Cloudflare Worker.
- Paste the code from
underconstruction.js
. - (Optional) Use your own MIDI file:
a. Upload your
.mid
file to a service like a CDN, an R2 bucket, or any public web server. b. Inunderconstruction.js
, update theMIDI_URL
constant with the link to your file. The default URL is just a nice-sounding example.const MIDI_URL = 'https://your-midi-file.mid';
- Route your traffic to this worker during maintenance periods:
export default { async fetch(request) { const handler = new UnderConstructionHandler(); return handler.handle(request); } }
To run this worker locally for development:
npm install -g @cloudflare/wrangler
wrangler dev --local