Backend - XMP Conversion API

This directory contains the Hono-based API server for XMP file conversion.

Files

  • index.ts - Main Hono application with API endpoints

API Endpoints

GET /

Serves the main web interface by reading and returning the frontend HTML.

POST /api/convert

Converts uploaded XMP files to Lightroom configuration format.

Request:

  • Content-Type: multipart/form-data
  • Body: Form data with xmpFile field containing the XMP file

Response:

{ "success": true, "config": "LIGHTROOM_GLOBAL_EXPOSURE=0.000000\n..." }

Error Response:

{ "success": false, "error": "Error message" }

GET /api/health

Health check endpoint that returns server status and timestamp.

File Serving

The backend serves static files from the frontend and shared directories using Val Town's utility functions:

  • /frontend/* - Frontend assets
  • /shared/* - Shared TypeScript modules

Error Handling

  • Validates file uploads (XMP files only)
  • Handles parsing errors gracefully
  • Returns appropriate HTTP status codes
  • Logs errors for debugging