| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
The VisualDx API provides the data and tools needed to create applications for both health care providers and patients. This Next.js sample application is a reverse proxy for accessing the VisualDx API's extensive library of curated medical images. It features:
✅ Automatic Token Management: Fetches and refreshes tokens automatically.
✅ Configurable Settings: Supports different audiences (consumer, clinical).
✅ Customizable Cache TTL: Cache duration is now adjustable via config.js.
✅ SEO-Friendly URLs: Supports /images/:size/:imageId/:filename.
✅ Error Handling: 302 redirects are handled invisibly, and 4xx errors bubble up and are returned.
The project includes the following dependencies:
git clone https://github.com/VisualDx/visualdx-api-image-proxy.git
cd visualdx-api-image-proxynpm installCreate a .env.local file in the root directory and set up API credentials:
# VisualDx API Base URL
API_BASE_URL=https://api.visualdx.com/v1/libraries/images
# Token Endpoint for authentication
TOKEN_URL=https://api.visualdx.com/v1/auth/token
# Authentication Credentials
CLIENT_ID=your_client_id
CLIENT_SECRET=your_client_secret
# Audience
AUDIENCE=consumer # Options: consumer, clinical
# Cache TTL (in seconds) - Default 72 hours (72 * 3600 = 259200 seconds)
CACHE_TTL=259200
Note: If your CLIENT_SECRET contains special characters, wrap it in double quotes:
CLIENT_SECRET="P@ssw0rd!"
Start the server with:
npm run devThe server will start at:
http://localhost:3000
Path: /api/images/:size?/:imageId/:filename?
With Size and Filename:
curl -X GET "http://localhost:3000/api/images/thumbnail/12345/sample-image.jpg" Without Size:
curl -X GET "http://localhost:3000/api/images/12345/sample-image.jpg" Without Filename:
curl -X GET "http://localhost:3000/api/images/12345" Valid Image Request:
Invalid Image ID:
Redirect Handling:
Cache Validation:
To build the application for production, run:
npm run buildAfter building the application, start the production server with:
npm startSEO-Friendly URLs:
Caching:
| Back | FazBrowse Home | New Git URL |