Public
Like
BingImageOfDay
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
index.tsx
https://wolf--a5e9d94206d911f0a183569c3dd06744.web.val.run
This Val Town project fetches, displays, and archives the Bing Image of the Day, providing an API to access both current and historical images.
- Fetch the current Bing Image of the Day
- Archive images to Val Town blob storage with date-based naming
- List all archived images with their dates
- Retrieve specific historical images by date
Endpoint | Method | Description |
---|---|---|
/ | GET | Returns the current Bing Image of the Day |
/list | GET | Returns a JSON object listing all archived images with dates as keys and URLs as values |
/get/:date | GET | Returns a specific archived image by date (format: MM-DD-YYYY) |
/backup | GET | Manually triggers a backup of the current Bing Image of the Day |
/docs | GET | Returns API documentation in JSON format |
- The service scrapes the Bing image from a public source (bing.gifposter.com)
- Images are stored in Val Town's blob storage with keys in the format
bing-images-of-day/MM-DD-YYYY.jpg
- The main API serves both current and archived images with proper caching headers
- Automation can be set up to trigger the backup endpoint daily to build a complete archive
GET /
Returns the current Bing Image of the Day as a JPEG with appropriate headers.
GET /list
Returns a JSON object like:
{ "1-15-2024": "https://your-val.web.val.run/get/1-15-2024.jpg", "1-14-2024": "https://your-val.web.val.run/get/1-14-2024.jpg", "1-13-2024": "https://your-val.web.val.run/get/1-13-2024.jpg" }
GET /get/1-15-2024
Returns the image for January 15, 2024 as a JPEG.