mirror of
https://github.com/HChaZZY/BingWallpaperAPI.git
synced 2025-12-06 10:13:49 +08:00
9cc075e5a513164f926e6d7765cc809c1e8734c5
BingWallpaperAPI
This project is a simple API service that caches the daily Bing wallpaper and provides it for use in other applications. It fetches the wallpaper metadata from the Bing API, downloads the image, and saves it locally.
Features
- Fetches the daily Bing wallpaper.
- Caches the wallpaper image and metadata.
- Provides an API endpoint to access the wallpaper.
- Automatically updates the wallpaper on a daily basis.
Installation
-
Clone the repository:
git clone https://github.com/HChaZZY/BingWallpaperAPI.git cd BingWallpaperAPI -
Install the dependencies:
npm install -
Docker (Optional)
-
Using Docker Compose:
docker-compose up -d -
Using Docker:
docker build -t bing-wallpaper-api . docker run -d -p 3000:3000 bing-wallpaper-api
-
Usage
-
Configure the settings in
config/default.jsonif needed:- Server port and host (
server.portandserver.host) - Bing API URL (
bing.apiUrlandbing.baseUrl) - Cache paths (
cache.pathandcache.metadataPath) - Update schedule (
schedule.checkInterval, using cron format) - Retry settings (
retry.maxAttemptsandretry.delayMs)
- Server port and host (
-
Start the server:
npm startAfter successful startup, the console will display the following information:
Listening 0.0.0.0:3000 http://localhost:3000 for Wallpaper -
Access wallpaper and health check:
- Wallpaper image:
http://localhost:3000/images - Health check:
http://localhost:3000/health
- Wallpaper image:
System Requirements
- Node.js >= 14.0.0
Main Dependencies
- Express: Web server framework
- Axios: HTTP client
- node-cron: Scheduled task scheduling
- Winston: Log recording
License
MIT License
© 2025 HCha. All rights reserved.
Languages
JavaScript
71.4%
HTML
27.1%
Dockerfile
1.5%